我正在jquery ajax上工作。我使用的代码如下:jquery Ajax中的返回值
var url = baseurl +"/index.php/users/ajaxwixusers";
var dataStringfirst = 'wixuserid='+ instanceId;
$.ajax({
//dataType : 'html',
type: 'GET',
url : url,
data : dataStringfirst,
complete : function() { },
success: function(data)
{
alert(data);
window.location.href="http://localhost:81/customers/index.php/acappointments/appointuseroverlay/user_id/203";
}
});
在PHP文件,我所获得的价值为:
echo $user_id = $wixuser->id;
我想回到成功的部份价值。当我试图提醒ajax的输出时。
它返回文件的完整HTML。我怎样才能返回唯一的价值,而不是完整的HTML?
使用json作为dataType –
dataType:'json', – Kotzilla
当我使用json然后没有返回 –