开发者

Place PHP in a DIV Using JQUERY

I would like to place some php code within a div with the class called "pickme" using jquery.

So basically, Jquery goes through the开发者_如何学JAVA DOM and finds every div with the class "pickme" and places a little php code in that div.

Any suggestions or codes used to perform this?


you could load the php page into the div with the jquery .load() function. That will call the php, but if you need to alter the pages contents based on that php, you will need to make that php page use jquery to make those changes (outside of the div).

$('#div').load('myPage.php');

myPage.php will load server-side, then display, giving you the functionality you are looking for.


You're mixing up server side and client side concepts. The php won't execute at this point. Placing php code in a div with jquery will not cause the php to execute for php is a server side language. javascript executes on the client.

You will need to use ajax to make page fragment updates. Look at ajax() for jquery or even load()

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜