0
我正在創建一個小部件。我的jQuery的功能是:將值從Jquery加載到PHP頁面時傳遞值
function init_widget(params){
var protocol=window.location.protocol;
var host=window.location.host;
$("#wd_id").load(protocol+"//"+host+"/testfolder/index.php");
}
在上面的代碼中,我使用jquery加載'index.php'。我也想將參數變量的值傳遞給index.php
。我一直在使用AJAX試了一下,通過執行類似
function init_widget(params){
var protocol=window.location.protocol;
var host=window.location.host;
$("#wd_id").load(protocol+"//"+host+"/cropimages/index.php");
$.ajax({
type: 'POST',
url:index.php,
data: param,
success: function() {
alert('asdf');
},
error: function(){
alert('failure');
}
});
}
但是,它顯示爲Uncaught ReferenceError: param is not defined
錯誤。有沒有人有任何線索爲什麼會發生這種情況。任何形式的積極建議表示讚賞。
在此先感謝....
用參數替換參數 –
@messifan感謝兄弟指出錯誤.... – V15HM4Y
在更改Messi粉絲建議的內容後,錯誤仍然出現嗎?如果是的話,代碼中的哪一點? –