Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/380.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用ajax将多个变量传递给其他页面_Php_Javascript_Jquery_Ajax - Fatal编程技术网

Php 使用ajax将多个变量传递给其他页面

Php 使用ajax将多个变量传递给其他页面,php,javascript,jquery,ajax,Php,Javascript,Jquery,Ajax,我在一个网站上工作,我必须重置页面上的密码脚本。为此,我使用ajax传递新旧密码,并希望在同一页面上获得结果 我的重置页面代码为:- <label>Enter current Password:</label><input id="cur_password" type="password" /><br/> <label>Enter New Password:</label><input id="new_password

我在一个网站上工作,我必须重置页面上的密码脚本。为此,我使用ajax传递新旧密码,并希望在同一页面上获得结果

我的重置页面代码为:-

<label>Enter current Password:</label><input id="cur_password" type="password" /><br/>
<label>Enter New Password:</label><input id="new_password" type="password" /><br/>
<label>Confirm New Password:</label><input id="confirm_password" type="password" /><br/>            
<a id="Reset_pass" class="submitButtons" value="Submit">Submit</a>
我处理此请求的java脚本页面是:-

$('#Reset_pass').click(function(){
var cur_password = $('#cur_password').val();
var new_password = $('#new_password').val();
var confirm_password = $('#confirm_password').val();
$('#current_password').parent().append("<img src=\"includes/ajaxLoader.gif\"");
$.ajax({
    url: 'ajaxServer.php?request=Reset_password',
    type: 'POST',
    data: {'cur_password': cur_password,'new_password': new_password,'confirm_password': confirm_password},
    dataType: "html",
    success: function(result){
        $('#current_password').parent().children('img').remove();
        $('#current_password').parent().children('span.updateResults').remove();
        $('#current_password').parent().append(result);
    }
}); 
 });
java脚本将值传递给页面名ajaxServer,如下所示:-

  if($request == "Reset_password")
  {
$db_name = "user_mgmt";
include "connections/Con.php";//for database connection
$temp=$_SESSION['username'];
$result = mysql_query("select Password from register where Unique_id=$temp");
$row = mysql_fetch_array($result);
$status=strcmp('$_POST[cur_password]','$row[0]');
$confirm_pass=strcmp('$_POST[new_password]','$_POST[confirm_password]');
if(($status==0)&&($confirm_pass==0))
{   
    $query = mysql_query("UPDATE register SET Password='$_POST[new_password]' where Unique_id='$temp'");
}
?>
<span class="updateResults">
<?php
if($query){
    echo "Your Password is reset";
}
else{
    echo "Unable ";
}
?>
</span>
}

但是java脚本代码中存在错误。这就是为什么它无法将信息发送到ajaxServer页面…请帮助我查找错误…提前感谢您分配错误属性,而不仅仅是成功,这样您就可以捕获错误。

请告诉我站点的名称,只是为了让我记住永远不要用我的密码信任它。你有一个SQL注入漏洞。永远不要用纯文本存储密码。@SLaks:是的,但这就是我的意思guess@LeleDumbo安全违规和SQL注入从来都不是问题。