lalnfl Posted October 23, 2010 Share Posted October 23, 2010 I have this xmlhttp.open("GET","promotions.php?promotion_id=$promotion_id&show_id=$show_id&add_match="+str,true); And I want to have it where the php $_GET variables can transfer into javascript variables so that I can have the $promotion_id and $show_id in the url. When I run my full script, and there is a form on there that goes to the same page, it shows promotions.php?promotion_id=$promotion_id&show_id=$show_id&add_match, but the $promotion_id and $show_id variables should be numbers, but I don't know how to transfer php GET variables to Javascript? Any help? Quote Link to comment https://forums.phpfreaks.com/topic/216628-php-variables-to-javascript-variables/ Share on other sites More sharing options...
trq Posted October 23, 2010 Share Posted October 23, 2010 If you want the variables to appear in the url, don't use Ajax. Quote Link to comment https://forums.phpfreaks.com/topic/216628-php-variables-to-javascript-variables/#findComment-1125513 Share on other sites More sharing options...
lalnfl Posted October 23, 2010 Author Share Posted October 23, 2010 Is there another way of getting info from the database thats not AJAX? Quote Link to comment https://forums.phpfreaks.com/topic/216628-php-variables-to-javascript-variables/#findComment-1125522 Share on other sites More sharing options...
trq Posted October 23, 2010 Share Posted October 23, 2010 Reload the page. Quote Link to comment https://forums.phpfreaks.com/topic/216628-php-variables-to-javascript-variables/#findComment-1125523 Share on other sites More sharing options...
lalnfl Posted October 23, 2010 Author Share Posted October 23, 2010 Without having to manually reload the page? There isn't anything similar to AJAX? Quote Link to comment https://forums.phpfreaks.com/topic/216628-php-variables-to-javascript-variables/#findComment-1125527 Share on other sites More sharing options...
trq Posted October 23, 2010 Share Posted October 23, 2010 If you want the url to change you need to change the page. There are ways of placing params within a url using anchor tags which allows book markable Ajax. However, without knowing your specific Ajax implementation you likely won't get allot of help in a simple forum reply. Google 'book marks ajax' or similar and you might find a few tutorials. This is however something that really needs to be though about from the startr of your application design and could require quite a bit of reworking if youve already got a significant amount of code. Quote Link to comment https://forums.phpfreaks.com/topic/216628-php-variables-to-javascript-variables/#findComment-1125537 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.