Hi guys,
I have some text inputs which I would like to submit to a database via PHP using ajax. What i want to do is when the submit button is pressed I want the forms to disappear and on their place to show up a message saying ...."thanks for submitting you data"... how can I do that. any help pls?
so i have - <form...><input.../>
-
<input>
-
<input type="submit">
-
</form>
after pressing on submit I want only the text form out of the whole page to disappear and the rest to remain and on their place to show up a message echo-ed by php.
7 1393
Bettor, please use CODE tags when posting source code. See the REPLY GUIDELINES on the right side of the page next time you post.
OK sorry for the mistake. I need help replacing forms with a successful submittion message using ajax. any help?
Hi guys,
I have some text inputs which I would like to submit to a database via PHP using ajax. What i want to do is when the submit button is pressed I want the forms to disappear and on their place to show up a message saying ...."thanks for submitting you data"... how can I do that. any help pls?
so i have - <form...><input.../>
-
<input>
-
<input type="submit">
-
</form>
after pressing on submit I want only the text form out of the whole page to disappear and the rest to remain and on their place to show up a message echo-ed by php.
Insert your Form inside a <div id="formName"> and On submit set the visibility property to hidden for it.
Then Remaining Task could Handle by Ajax, ResponseTexts.
If I am using the following ajax function - <script type="text/javascript">
-
function ajaxFunction()
-
{
-
var xmlHttp;
-
try
-
{
-
// Firefox, Opera 8.0+, Safari
-
xmlHttp=new XMLHttpRequest();
-
}
-
catch (e)
-
{
-
// Internet Explorer
-
try
-
{
-
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
-
}
-
catch (e)
-
{
-
try
-
{
-
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
-
}
-
catch (e)
-
{
-
alert("Your browser does not support AJAX!");
-
return false;
-
}
-
}
-
}
-
xmlHttp.onreadystatechange=function()
-
{
-
if(xmlHttp.readyState==4)
-
{
-
document.myForm.time.value=xmlHttp.responseText;
-
}
-
}
-
xmlHttp.open("GET","time.asp",true);
-
xmlHttp.send(null);
-
}
-
</script>
how should I change - document.myForm.time.value=xmlHttp.responseText;
to address the div id=someid
Exelent, at least you are trying http://www.w3schools.com.But I am Not recomending the GET method to submit your Form data. How about POST.[BTW you can use GET also]. - Create a Form by putting id for each form element in the form.
- Onsubmit the pass call for javascript function to collect the Submitted data from the form.
- On the Page where you have created your Form create empty div.
- <div id="status_msg"></div>
-
-
-
-
-
-
-
-
- If you are familiar with readyState property of t XMLHttpRequest you can write down some messages to the status_msg div while the process is going on and and also you can hide your Form at the same time.
P.S. I can Send you the code but how about learning it step by step your self. I think you are not in a hurry.
Exelent, at least you are trying http://www.w3schools.com.But I am Not recomending the GET method to submit your Form data. How about POST.[BTW you can use GET also]. - Create a Form by putting id for each form element in the form.
- Onsubmit the pass call for javascript function to collect the Submitted data from the form.
- On the Page where you have created your Form create empty div.
- <div id="status_msg"></div>
-
-
-
-
-
-
-
-
- If you are familiar with readyState property of t XMLHttpRequest you can write down some messages to the status_msg div while the process is going on and and also you can hide your Form at the same time.
P.S. I can Send you the code but how about learning it step by step your self. I think you are not in a hurry.
Ajaxrand is right.
It is better to learn it from yourself instead of taking the help from the beginning.
And one thing you have not pass the parameters which you want to submit.
Follow dis code it may help you to do it. -
if(XMLHttp.readyState==4 && XMLHttp.status==200)
-
{
-
document.write(XMLHttp.responseText);
-
}
-
else{alert("There is something error with the target page");}
-
Best of luck with your try.
Kind regards,
Dmjpro.
Heya, Bettor.
Thanks for using CODE tags! Did you know that you can specify a language for your CODE tags to make your source code easier to read (and therefore make it more likely that our Experts will post solutions)?
You will still need to use [/code] to close your code blocks, regardless of the language, but you can the use one of these tags to open your code block:
[code=html]
[code=javascript]
[code=php]
and so on.
Thanks!
MODERATOR
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Richard Dixson |
last post by:
I have code that calls document.myFormName.submit() to submit a form
automatically via JavaScript. This works just fine.
However, if there is a button (or other form field element) on the form...
|
by: sandipm |
last post by:
Hi all,
I am facing problem with updating form element using javascript in
MOZILLA
Details are as follows.
I have a div containing form element. on submit , i am submitting the
form using...
|
by: Alok yadav |
last post by:
I have an open IP and on that IP our main application is hosted. it uses
ajax. in web.config file i have register ajax handlers.
there are also other sites or project on that IP. now my problem is...
|
by: monudjn |
last post by:
Hi I am implementing ajax in portal. Using ajax i am able to updating the content of portlets asynchronously. However i am facing a problem
The Problem: While submitting the form i am getting...
|
by: Advo |
last post by:
Basically, im redesigning a form page on our website.
Currently the user submits the form, it does a few javascript checks
and either submits to the "processstuff.php" page, or gives the user a...
|
by: javelin |
last post by:
I need to fire off some server side code, but I don't want to submit
the page I'm on. I know that's not technically possible (without
something like AJAX, maybe?). What I thought might work is to...
|
by: paratge |
last post by:
Hi,
I'm updating one form in an iframe, with another in a main page. That
works fine, th probliem is how to submit two forms with one click.
For now i get an error "permission denied" how can...
|
by: K. |
last post by:
Hi!
I have problem with Firefox. I have such code:
<?
$xml = "<?xml version='1.0' encoding='utf-8' ?>";
$xml.="<table>";
$xml.="<tr><td colspan=\"5\">
<input type=\"hidden\"...
|
by: shivendravikramsingh |
last post by:
hi friends, i m using a ajax function for retrieving some values from a database table,and display the values in required field,my prob is that the ajax function i m using is working f9 once,but if...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
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...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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...
|
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...
|
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...
| |