Makketronix
Makketronix

Reputation: 1460

Using post method in javascript

I would like to send text inside textarea to php using post method. I created a button, and I can extract the text from the textarea into a variable.

How can I pass the variable to php using POST and NOT using ajax or other libraries? Is there a simple way?

If not, how does ajax do it?

Upvotes: 0

Views: 63

Answers (1)

Daniel Scott
Daniel Scott

Reputation: 7961

Do you have to use javascript? If you don't want AJAX, then why not just use a standard HTML form submission? You can setup everything using javascript to build the HTML form and the browser will do the submission for you?

JavaScript post request like a form submit

If it must be javascript, then it might be simplest to use JQuery to make an AJAX call.

http://www.w3schools.com/jquery/ajax_post.asp

Upvotes: 1

Related Questions