I have a pretty basic jQuery ajax thing happening, but I want to mix form data that is retrieved by JS with some PHP variables and have them all sent as part of the ajax GET. Should this work?:
var longform = $("input:text").serialize();
$.ajax({
url: 'actions/create.php',
data: longform + "domain=<?php echo $domain; ?>&useragent=<?php echo $useragent; ?>&ip=<?php echo $ip; ?>&cookieuser=<?php echo $cookieuser; ?>",
Currently, when create.php tries to echo the variables back, they're empty.
UPDATE
After checking the source as suggested, it comes out like this:
data: longform + "&domain=example.com&useragent=Mozilla/5.0
You need to add an ampersand (&) before domain=. Otherwise, it should be fine.
Do a View Source on the page and make sure the javascript string looks correct as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With