reyes99 Posted November 13, 2012 Share Posted November 13, 2012 Hello all, I have this javascript that I am calling when I push a button. I want to load the popup programatically not by a button event. in popup.js I have the following function that loads the popup. //LOADING POPUP //Click the button event! $("#button").click(function(){ //centering with css centerPopup(); //load popup loadPopup(); }); My question is how do I load the popup from a php script by assigning a variable. for example <?php if ($loadpup = 'yes') { load the popup ( what command can I use that will activate the popup??) } ?> Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/270652-call-js-function-form-php/ Share on other sites More sharing options...
Adam Posted November 13, 2012 Share Posted November 13, 2012 You need to look into AJAX. Quote Link to comment https://forums.phpfreaks.com/topic/270652-call-js-function-form-php/#findComment-1392157 Share on other sites More sharing options...
codefossa Posted November 14, 2012 Share Posted November 14, 2012 Either use $_GET or $_POST, then with jQuery (or you can use $.ajax) but with jquery it's $.load() or $.post() Check that a post or get var isset() or you can use the same var with multiple values. Up to you. If you were talking about triggering a JS function inside of PHP, then you're going at it backwards. JS is client-sided after the site content has been downloaded to the browser. It doesn't interact with the server any more than posting or getting a page from the same domain. Quote Link to comment https://forums.phpfreaks.com/topic/270652-call-js-function-form-php/#findComment-1392159 Share on other sites More sharing options...
reyes99 Posted November 14, 2012 Author Share Posted November 14, 2012 Thanks guys, looks like I have to do some more research. Quote Link to comment https://forums.phpfreaks.com/topic/270652-call-js-function-form-php/#findComment-1392162 Share on other sites More sharing options...
Adam Posted November 14, 2012 Share Posted November 14, 2012 Either use $_GET or $_POST, then with jQuery (or you can use $.ajax) but with jquery it's $.load() or $.post() Hmm, what? All three of those are jQuery. In-fact, the last two are short-cuts for jQuery.ajax. Quote Link to comment https://forums.phpfreaks.com/topic/270652-call-js-function-form-php/#findComment-1392164 Share on other sites More sharing options...
codefossa Posted November 14, 2012 Share Posted November 14, 2012 (edited) Hmm, what? All three of those are jQuery. In-fact, the last two are short-cuts for jQuery.ajax. You can alternatively just include ajax though, can't you? Pretty sure it's what I used to do before I actually started using jQuery much. Eh, maybe I just remember it as part of the URL. Idk it was too long ago. When I finally started using jQuery I never went back to using $.ajax so sorry if I was mistaken there. Edited November 14, 2012 by Xaotique Quote Link to comment https://forums.phpfreaks.com/topic/270652-call-js-function-form-php/#findComment-1392166 Share on other sites More sharing options...
Adam Posted November 14, 2012 Share Posted November 14, 2012 You can alternatively just include ajax though, can't you? Pretty sure it's what I used to do before I actually started using jQuery much. As far as I'm aware, you can't create custom builds of the core. Only the UI extension allows you to do that. Quote Link to comment https://forums.phpfreaks.com/topic/270652-call-js-function-form-php/#findComment-1392202 Share on other sites More sharing options...
codefossa Posted November 14, 2012 Share Posted November 14, 2012 As far as I'm aware, you can't create custom builds of the core. Only the UI extension allows you to do that. Well, atleast I learned something new. (: Quote Link to comment https://forums.phpfreaks.com/topic/270652-call-js-function-form-php/#findComment-1392207 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.