我正在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然後沒有返回 –