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...

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...

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.