f



Sending POST to an AJAX script

How do I send POST queries to an AJAX script, eg, say there is a form with a Submit button, upon clicking of which I would like a "Message sent" displayed with NO refresh - then what do I do? How do I send the form args to the (say, PHP) script?


Thanks,
0
bit
12/11/2016 5:23:00 PM
comp.lang.javascript 38370 articles. 0 followers. javascript4 (1315) is leader. Post Follow

2 Replies
302 Views

Similar Articles

[PageSpeed] 4

On 11-12-16 18:23, bit-naughty@hotmail.com wrote:
> How do I send POST queries to an AJAX script, eg, say there is a form with a Submit button, upon clicking of which I would like a "Message sent" displayed with NO refresh - then what do I do? How do I send the form args to the (say, PHP) script?
>
>
> Thanks,
>


<form action="some-php-page.php" method="post">
......
<button type="submit">Send your message</button>
</from>


In your 'some-php-page.php', you should see the variables in your $_POST
( http://php.net/manual/en/reserved.variables.post.php )
0
Luuk
12/11/2016 5:48:06 PM
On Sun, 11 Dec 2016 09:23:00 -0800 (PST), bit-naughty@hotmail.com wrote:
> How do I send POST queries to an AJAX script, eg, say there is a form with
> a Submit button, upon clicking of which I would like a "Message sent"
> displayed with NO refresh - then what do I do? How do I send the form
> args to the (say, PHP) script?
> 
> Thanks,

See below example.

<https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Forms/Sending_forms_through_JavaScript#Building_an_XMLHttpRequest_manually>

I'd suggest you learn DOM first if you're still clueless.
0
JJ
12/12/2016 5:25:29 AM
Reply: