473,439 Members | 1,963 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,439 software developers and data experts.

how to submit form using ajax

254 100+
Hi

I am displaying a page (result.php) using ajax and in this page I have few links when clicked opens a div popup. in which a form, a text field and a submit button is there. when I click submit it should display message in this page which called using ajax(result.php). but actually it is not happening. I want user to be on the same page i.e. result.php
Jun 23 '09 #1
5 6093
acoder
16,027 Expert Mod 8TB
Can you post your code?
Jun 23 '09 #2
mukeshrasm
254 100+
@acoder
here is the code for the page which is displayed using ajax in this page div popup opens form and that form I want to submit and display the message in this page or some thing like so that user can know that it is submitted and stays on this page

Expand|Select|Wrap|Line Numbers
  1. <a href="#" id="prin">Print</a> | <a href="#" onclick="setVisible('layer1');return false" target="_self">Send as Email</a>| <a href="#" id="std">Save to Desktop</a>
  2.  
  3. <div id="layer1">
  4.   <span id="close"><a href="javascript:setVisible('layer1')" style="text-decoration: none"><strong>Hide</strong></a></span>
  5.   <p><form method="post" action="" name="emailSubmit"> <label> Email Address<input type="text" /></label>
  6.   <br /><input type="submit" value="Send" name="EmainSend" /><input type="hidden" value="" id="hiddenEmail" name="emailfile" /></form></p>
  7. </div>
  8.  
Jun 23 '09 #3
acoder
16,027 Expert Mod 8TB
So you want to send two values: the email text box and the hidden field. A form submit is simply an Ajax POST request to the action page. Remember that for post you need to send the values using the send() method, not via the URL as you would with GET. I would suggest that you add an ID to the text field, so that you can easily access it.
Jun 23 '09 #4
mukeshrasm
254 100+
@acoder
Expand|Select|Wrap|Line Numbers
  1. var url="result.php";
  2.     url=url+"?q="+str;
  3.     url=url+"&sid="+Math.random();
  4.     xmlHttp.onreadystatechange=stateChanged ;
  5.     xmlHttp.open("GET",url,true);
  6.     xmlHttp.send(null);
  7.  
this is for using get method so what i need to change in this code.
Jun 27 '09 #5
acoder
16,027 Expert Mod 8TB
Here is a simple POST example.
Jun 29 '09 #6

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

Similar topics

2
by: vishal | last post by:
hello friends i have one php script which generates html page containing form. what i want is submit this form using php script. pls give me some idea that how can i submit form using php...
7
by: Rui Pestana | last post by:
Hello all, I want to use the POST method to submit the form and then grab the parameters in the asp file with request.form("parm"). The problem is that I am using the _search target to open...
4
by: btopenworld | last post by:
I am submitting a form using an image as the link to a js file. The image calls a js function which checks fields- issuing alerts for errors - if no errors it then submits the form. I would like...
4
by: Sean K via .NET 247 | last post by:
(Type your message here) -------------------------------- From: Sean K Hi There, I am new to asp.net and I would like to find some code or a tutorial that will allow me to submit a form...
5
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...
2
by: awi | last post by:
Hi Everyone, I'm facing a unique problem when testing with FireFox (at least, I think its unique). Here is the situation: I have a page setup that looks like this: <form id="abcForm"> <div...
6
by: dmorand | last post by:
I'm having a little trouble with my ajax. I can see my results in IE, but not firefox. I'm assuming I'm missing some syntax somewhere. alert("Test " + results + testing); returns the values in...
1
by: biggie3384 | last post by:
Is it possible to submit a form using ajax? I have a form with sever inputs and when submited, it writes the input values in a jsp file. I would like to submit the form using ajax in the...
1
by: mfaisalwarraich | last post by:
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. function showPage(page) { var...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.