2
我有這樣jQuery的負載缺少參數
function firstload(maxid, next_page, results, animation_image, btn_load, url, endpoint) {
var a = ''+maxid+'';
var b = ''+next_page+'';
var c = ''+endpoint+'';
$('#'+results+'').load('<?php echo base_url()?>create/firstload', { max_id: a, next_page: b, endpoint: c }, function() {
var nextpage = $('#'+next_page+'').val();
if (nextpage != 0) { $('.'+btn_load+'').show(); }
else { $('.'+btn_load+'').hide(); }
$('.'+animation_image+'').hide();
});
}
firstload('max_id','nextpage','results','animation_image','load_more','load','get_user_recent');
和PHP後端這樣的代碼:
function firstload($max_id, $next_page, $endpoint) {
echo '<p> '$max_id' </p> //just a piece of code
}
[編輯]我添加一些代碼的功能。 我希望在前端編號#result包含來自firstload函數的'max id'。
但它返回的一些錯誤:
Severity: Warning
Message: Missing argument 1 for Create::firstload()
Filename: controllers/Create.php
Line Number: 156
和它發生在參數2和3了。
我的代碼有什麼問題?
當你看到網絡請求時,你會看到什麼? – epascarello
這是一個PHP錯誤 - 您需要確保您有呼叫中的所有參數。 – user2182349
您使用的是PHP框架嗎?預期如何將參數傳遞給'Create'控制器中的'firstload'函數? – GeorgeQ