小编Mar*_*ews的帖子

使用jquery上载文件而不刷新页面

我有一个更新个人资料页面.它有三种形式,它使用get请求来显示任何一种形式.就像update_profile.php?type=profile让用户编辑他的个人资料一样,update_profile.php?type=settings让用户编辑他的帐户设置.

类型:个人资料有文件输入,我希望用户能够在没有页面刷新的情况下上传.现在这不能使用ajax完成,所以我需要一个解决方法.我已经尝试过iframe方法,xhr2方法和html5 + ajax方法,有人在stackoverflow上发布了这个方法.

因此,如果有人愿意通过详细的步骤向我解释事情,我将不胜感激.这是我的HTML:

<script type='text/javascript'>    
function nouser() {
        $().toastmessage('showToast', {
            text     : 'The user does not exist',
            sticky   : true,
            position : 'middle-center',
            type     : 'error',
            closeText: '',
            close    : function () {
                console.log("toast is closed ...");
            }
        });

    }
</script>    

<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>Update Profile</title>
<link rel="shortcut icon" type="image/png" href="includes/template/images/favicon.png" />

<link rel="stylesheet" type="text/css" href="includes/template/css2/style.css" />
<link rel="stylesheet" type="text/css" href="includes/jquery/toast/resources/css/jquery.toastmessage.css" />
<link rel="stylesheet" type="text/css" href="includes/jquery/notification/css/jquery_notification.css" />


<script type="text/javascript" src="includes/jquery/jquery_v_1.4.js"></script> …
Run Code Online (Sandbox Code Playgroud)

html php jquery file-upload

5
推荐指数
1
解决办法
5352
查看次数

标签 统计

file-upload ×1

html ×1

jquery ×1

php ×1