Jump to content

Call Js Function Form Php


reyes99

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by Xaotique
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.