How to update the value of input when ajax submits data in php

Source: Internet
Author: User
In php, how does one update the value of input when ajax submits data? The title cannot be clearly stated. here we will talk about it slowly: ajax requires the corresponding php script to have a display form content. I need to submit this script, so I used ajax to submit data again, however, a problem is found. & lt; input & nbsp; type = "te php: How does ajax submit data to update the value of input?
The title is unclear:
Ajax requires the corresponding php script to have a display form content. I need to submit this script, so I used ajax to submit data, but I found a problem,





In this case, when the content in the input box changes, $ value also changes. do you know any good method? In other words, the method that can easily submit input values cannot be submitted using form in Ajax.
------ Solution --------------------
Obtain Value
Why can't I submit data through ajax?
------ Solution --------------------
"In this case, $ value also changes when the content in the input box changes."
-- How can this sentence be understood? Do you want to submit only when the value of the input box is changed?
------ Solution --------------------
Why cannot I use form to submit ajax?


Script
Function yourCallBack (){
Alert ('submitted ');
}
Document. getElementById ('yourform'). submit ();
Script

Then you are in youphp. php.
Script
Window. parent. yourCallBack ();
Script
------ Solution --------------------
Reference:
"In this case, $ value also changes when the content in the input box changes."
-- How can this sentence be understood? Do you want to submit only when the value of the input box is changed?

I cannot understand it at all.
------ Solution --------------------

Script

Function do_ajax (){
Var a = $ ("# abc"). val ();
Alert ();
/* $. Ajax ({
// Put Your AJAX code here
});*/
}
Script
// Remove the value attribute. the above a is equivalent to the value


------ Solution --------------------
"/>

Script
Function doAjax (){
Var val = document. getElementById ('key'). value; // obtain the value of the input box.
... Ajax submit...
}
Script

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.