Jump to content

javascript variable to php variable


anton578

Recommended Posts

Yes and no.  Yes you can pass a var to php, using AJAX, and it doesn't have to reload the page, but it won't change anything on the page unless you tell it to...

 

No, are you sure the purpose of this is logically correct?  Explain what you're trying to do...

 

 

 

thanks for the reply... im sorry im new to this can you give me an example of ajax on how to pass variable without reloading page...

 

my purpose is im gonna need that javascript variable to be a php variable so i can use that variable for my php script...

Link to comment
Share on other sites

If you're submitting a form, set the javascript value to a hidden field

 

<script type="text/javascript">
  document.write('<input type="hidden" name="fromJS" value="'+ myVal +'">');
</script>

 

Otherwise, please visit the ajax board, there are links for tutorials there, or they are searchable online.

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.