开发者

onclick .load() 2 variables

Using开发者_JAVA技巧 this script to send id to file.php which queries database and returns output in #DIV,

function recp(id + page) {

 $('#DIV').load('file.php?id=' + id + '& page=' + page);

}

works fine with just (id) but no luck with 2 variables. Checked on the appropriate sites without any result.

How would I also configure my Onclick=recp('$id ...')

Help much appreciated!


There is a space in your query string. It should be:

$('#DIV').load('file.php?id=' + id + '&page=' + page);

It is much neater to pass an object as second [data] parameter:

$('#DIV').load('file.php', {id: id, page: page});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜