473,929 Members | 15,612 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

form POST values using ajax

194 New Member
I am trying to get values posted by a form using ajax but i dont know how to get them. im opening a form which is also based on the ajax. here is the code.
Expand|Select|Wrap|Line Numbers
  1. function showPage(page)
  2. {
  3. var url=page;
  4. //url=url+"?q="+page;
  5. //url=url+"&sid="+Math.random();
  6.  
  7. if (window.XMLHttpRequest)
  8.   {// code for IE7+, Firefox, Chrome, Opera, Safari
  9.   xmlhttp=new XMLHttpRequest();
  10.   }
  11. else
  12.   {// code for IE6, IE5
  13.   xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  14.   }
  15. xmlhttp.onreadystatechange=function()
  16.   {
  17.   if (xmlhttp.readyState==4 && xmlhttp.status==200)
  18.     {
  19.     document.getElementById("container").innerHTML=xmlhttp.responseText;
  20.     }
  21.   }
  22. xmlhttp.open("GET",url,true);
  23. xmlhttp.send();
  24. }
  25.  
the above code is just taking a url and displaying it into div. when im displaying a form using showPage('form. php'), the form is displayed correctly. im using the same function on the form action='showPag e('submit.php') and method='post' but this is not posting any data. please tell me wat im doing wrong and how i can get the posted data without defining any variables in the javascript. thanx

the form code is as follows:

Expand|Select|Wrap|Line Numbers
  1. <div id="admForm">
  2. <form name="form1"  action="javascript:showPage('admission-form.php')" method="post">
  3. <input type="text" name="username" />
  4. <input type="password" name="password" />
  5. <input type="submit" name="submit" value="Submit" />
  6. </form>
  7. </div>
  8.  
Apr 22 '10 #1
1 1993
jords
1 New Member
help me pls, how to post the inputs of the user from the forms to the popup window of java pls help
Apr 22 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

27
4799
by: Chris | last post by:
Hi, I have a form for uploading documents and inserting the data into a mysql db. I would like to validate the form. I have tried a couple of Javascript form validation functions, but it appears that the data goes straight to the processing page, rather than the javascript seeing if data is missing and popping up an alert. I thought it may be because much of the form is populated with data from the db (lists, etc.), but when I leave...
5
3561
by: Charlie King | last post by:
I'm trying to send data to a remote script (a credit card processing third party) from my site using POST. Currently, I'm doing it using the ususal form dynamically built with my values. This is less than ideal because I want to perform local processing (updating order status in the local database) and then to proceed to the remote script, with resultant values, without relying on the user pressing a button.
4
4993
by: d3vkit | last post by:
I have a form on my page, and some javascript which uses ajax to submit the form, and then opens the new page in a div using ajax so there is no refresh. This works fine. But the problem is this: all values seem to pass except what the submit buttons say. I have a preview button and a finish button, and need to check which was pressed. I can add a checkbox for submit, but that's annoying. I'm using mootools for the ajax call, so it might not...
5
3236
by: lucyh3h | last post by:
Hi, I am trying to use XMLHttpRequest to do server side validation. I have several fields on a form and a submit button. The submit button has an event assocated with it when clicked. The javascript method will do the form validation for each field one by one. For each field, an XMLHttpRequst will be made to a PHP file and get the return, either set an error field (<span>'s innerHTML) or leave it empty. Then I'll check the error field...
19
3326
by: klenwell | last post by:
Another request for comments here. I'd like to accomplish something like the scheme outlined at this page here: http://tinyurl.com/3dtcdr In a nutshell, the form uses javascript to hash (md5) the password field using a random one-time salt (nonce) -- generated by php and pasted in the form -- that is then posted with the hashed password
7
10309
xNephilimx
by: xNephilimx | last post by:
lHi guys! I'm having a little problem that's getting on my nerves, I couldn't find a solution, I also tryed googling it and I found nothing... (my field of expertise is in AS 2 and 3, but I still lack some JavaScript solid knowdlege) The problem is that when I try to send a form's content with Ajax (I'm using the prototype library), for some reason the latin characters (accents and stuff, like áéíóú) turn a mess when I try to store them in...
2
2019
by: ravisuguna | last post by:
Hi, I have a php page which has some checkboxes ,textfields and values.If I select a checkbox ,a particular value will be displayed in a textfield.I have a "go"button in the same page.I want the selected values and textfields to be displayed in the next page if i click the button.Pl guide me how to do this. I am sending the sample code below. arical.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
2
3013
by: Mike | last post by:
Hello, I am trying to pass a js array ,Round1, to a form and send it. I can get it to work with serialized values but I want to send the data as an array. The arrays are filled with data. I am getting an error. in the JS: document.forms.Result1.value = Round1; document.forms.Result2.value = Round2; document.forms.Result3.value = Round3;
1
1234
paulrajj
by: paulrajj | last post by:
hi all, i am using php with ajax to load a page. i am using a page that contains ajax to access another page in same file. In the ajax calling page i am having form to post the values and stored it in database. The form elements are not posting if i access apage using ajax. ?Is there any solution for this? thanks in advance.
4
1727
paulrajj
by: paulrajj | last post by:
hi all, i am using php with ajax to load a page. i am using a page that contains ajax to access another page in same file. In the ajax calling page i am having form to post the values and stored it in database. The form elements are not posting if i access apage using ajax. ?Is there any solution for this? thanks in advance.
0
10110
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11473
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11045
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11233
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9820
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8182
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6041
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4870
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3464
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.