OGeek|极客世界-中国程序员成长平台

标题: ajax - Best way to pass parameters to jQuery's .load() [打印本页]

作者: 菜鸟教程小白    时间: 2022-5-24 03:07
标题: ajax - Best way to pass parameters to jQuery's .load()

Is there a difference in passing parameters to .load

$("#myDiv").load("myScript.php?var=x&var2=y&var3=z")

vs

$("#myDiv").load("myScript.php", {var1:x, var2:y, var3:z})

Also, is there a size limit to how much .load can handle? Can myScript.php return a couple hundred rows of data without issue?



Best Answer-推荐答案


In the first case, the data are passed to the script via GET, in the second via POST.

http://docs.jquery.com/Ajax/load#urldatacallback

I don't think there are limits to the data size, but the completition of the remote call will of course take longer with great amount of data.






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://www.ogeek.cn/) Powered by Discuz! X3.4