1

I can submit one input field data through ajax to a php file and then that php file update it in database. Last portion of code i write for ajax in javacript is below

parameter = 'create_name='+document.create_user_cl.create_name.value;
    xmlhttp.open('POST', 'php/add_user.php', true);
    xmlhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
    xmlhttp.send(parameter);

Everything works uptil here.

Now I have multiple input fields like name, username, password etc and i want to submit all input field's data via post through Ajax to the php file but i don't know how should i modify that parametervariable or xmlhttp.send() so that i can send multiple input field data. I can do it with GET but i want to achieve this through POST. I am new to ajax, please help

Harry
  • 11
  • 3
  • https://www.google.com/search?rlz=1C1CHBF_enUS761US761&ei=b08tWpGlFomX_Qbq97OwAw&q=send+form+data+via+ajax+-jquery&oq=send+form+data+via+ajax+-jquery&gs_l=psy-ab.3...31947.34005.0.34215.8.8.0.0.0.0.120.615.6j2.8.0....0...1c.1.64.psy-ab..0.2.202...0i22i30k1.0.8bVoqXP5UKg – Scott Marcus Dec 10 '17 at 15:15
  • sir please help, stuck here for long time. – Harry Dec 10 '17 at 15:18
  • check this questions https://stackoverflow.com/questions/9713058/send-post-data-using-xmlhttprequest – Noman Khan Dec 10 '17 at 15:18

0 Answers0