开发者

php variable to know when jquery has loaded?

开发者 https://www.devze.com 2023-01-05 03:07 出处:网络
I know you can get a $_SERVER[\'HTTP_X_REQUESTED_WITH\'] php variable if jquery has loaded. That\'s great but if you use an iframe then that variable is no longe开发者_如何转开发r available. Is there

I know you can get a $_SERVER['HTTP_X_REQUESTED_WITH'] php variable if jquery has loaded. That's great but if you use an iframe then that variable is no longe开发者_如何转开发r available. Is there a way to detect if jquery has loaded and give php a varaible in an iframe? I don't want to load a header or footer if jquery has loaded 100% but otherwise put them on. I have to use an iframe so there is no way around that. (I'm using a Colorbox iframe).

Thank you.


This approach seems error-prone. Do you have a good reason for waiting until jQuery has loaded before loading the header and footer? Are these actions that could be performed client-side via jQuery's AJAX functions?


I know you can get a $_SERVER['HTTP_X_REQUESTED_WITH'] php variable if jquery has loaded.

That's not what that variable indicates.

That variable indicates that a particular request was made with jQuery's AJAX functions.


You probably want to hide the content with CSS using "display:none;" when Colorbox is enabled, You'd be still loading the footer and header but they won't show up


PHP => Browser => Javascript

You can't communicate from javascript to php such that php would genereate different data based on javascript.

You can do a documentReady() to hide a div when jquery is loaded.

0

精彩评论

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

关注公众号