對不起,我的條件,因爲他們是不正確的,但我有一個php函數,我要與ajax互操作,所以我可以使用PHP函數來獲得jquery變量的值。我怎樣才能設置一個jQuery的var是另一個jQuery的ajax函數回調
所以,現在我只是在我已經收到了Ajax回調,並想設置jQuery變量爲我回來的響應值。這裏是我的代碼爲例:
$(document).ready(function() {
$('body').videoBG({
position:"fixed",
zIndex:0,
mp4:'', //This is where I want to use the ajax response value
opacity:1,
});
})
jQuery.ajax({
type : "POST",
url : "index.php",
data : {
request : "getvideo_Action"
},
success : function(response) {
alert(response);
//Do my response stuff
}
});
所以基本上我想要做的是設置'MP4的VAR(或者是財產?)有,我從響應中獲得的價值。任何人都可以幫我解決這個問題嗎?謝謝。
你將需要移動需要Ajax請求的Ajax請求的成功裏面的響應代碼。 –
http://stackoverflow.com/questions/14220321/how-to-return-the-response-from-an-ajax-call?rq=1 – Blazemonger