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