No value is obtained when Ajax asynchronously attaches a value.
The problem is that the Ajax function is called in JavaScript to attach a value to the hidden text box "hidname,
The value of hidname is blank when you call the function. However, if you alter the value of this field when reading the value of hidname, you can read the exact value,
At the beginning, I felt very strange. I had never been confused about why alter had a value, but I couldn't get the value without alert. Then I found out that it was
Ajax Asynchronization makes it difficult to execute a function called by five lines at the same time, so seven lines cannot get the value.
Function ()
{
If (OBJ! = NULL)
{
Ajaxcommon. getdata (obj. Value, getresult_callback); // 5 rows
// Alert (document. getelementbyid ("hidname"). Value); // 6 rows
VaR STR = Document. getelementbyid ("hidname"). value; // 7 rows
Alert (STR );
}
}
Function getresult_callback ()
{
Document. getelementbyid ("hidname"). value = "1 ";
}