Ajax Hide Hidden Problem Solving Method _ Basics

Source: Internet
Author: User
I have two table on the page, call Ajax after hiding one, and then use HTML to spell another table, the results of the new table has a undefined, how this is caused, how to solve it? The detailed code is as follows:
Copy Code code as follows:

<script type= "Text/javascript" >
$ (function () {
if ($.browser.msie)
{
$ ("#country"). Get (0). attachevent ("Onpropertychange", Function (o) {
var countr = O.srcelement.value;
$ ("#tabb1"). Hide ();
$.ajax ({
Type: "Post",
URL: "/yoblhtjfx/querycountryajax.action",
Data: "country=" +countr+ "&jsoncallback=?",
DataType: "JSON",
Success:function (JSON)
{
var tablehtml;
tablehtml+= "<table id= ' tabb1 ' border= ' 1 ' width= ' 100% ' >";
tablehtml+= "<tr>";
tablehtml+= "<td style= ' Text-align:center ' > Selection </td>";
tablehtml+= "<td style= ' text-align:center ' > Area code </td>";
tablehtml+= "<td style= ' Text-align:center ' > Country name </td>";
tablehtml+= "</tr>";
var list = Json.list;
for (Var i=0;i<list.length;i++)
{
tablehtml+= "<tr>";
tablehtml+= "<td style= ' text-align:center ' ><input type= ' radio ' name= ' radioo ' ' value= '" +list[i][1]+ ' "/>" </td> ";
tablehtml+= "<td style= ' Text-align:center ' >" +list[i][0]+ "</td>";
tablehtml+= "<td style= ' Text-align:center ' >" +list[i][1]+ "</td>";
tablehtml+= "</tr>";
}
tablehtml+= "</table>";
$ ("#querycountrydiv"). HTML (tablehtml);
}
});
});
}
});
function ReturnVal ()
{
var Valu;
for (var i = 0;i < Document.getelementsbyname ("Radioo"). length;i++)
{
if (Document.getelementsbyname ("Radioo") [i].checked = = True)
{
Valu = Document.getelementsbyname ("Radioo") [I].value;
}
}
Window.opener.document.getElementById ("Foreignunitcountry"). Value = Valu;
Window.close ();
}
</script>
<body>
<div align= "center" style= "width:100%;" >

Enter Name search:
Copy Code code as follows:

<input id= "Country" name= "Country" "value=" ">
</div>
&LT;HR id= "hr"/>
<div id= "Querycountrydiv" name= "Querycountrydiv" style= "width:100%"; height:80%; Overflow:auto; border:1px solid #000000; " >
<table id= "TABB1" border= "1" width= "100%" >
<tr>
&LT;TD style= "Text-align:center" nowrap= "nowrap" > Selection </td>
&LT;TD style= "Text-align:center" nowrap= "nowrap" > Area code </td>
&LT;TD style= "Text-align:center" nowrap= "nowrap" > Country name </td>
</tr>
<c:foreach items= "${list}" var= "List" >
<tr>
&LT;TD style= "Text-align:center" nowrap= "nowrap" ><input type= "Radio" name= "Radioo" value= "${list[1]}"/> </td>
&LT;TD style= "Text-align:center" nowrap= "nowrap" >${list[0]}</td>
&LT;TD style= "Text-align:center" nowrap= "nowrap" >${list[1]}</td>
</tr>
</c:forEach>
</table>
</div><br>
&LT;HR id= "hr"/>
<div>
<input id= "button" type= "button" value= "to determine" onclick= "returnval ();"/>
<input id= "button" type= "button" value= "closes" onclick= "window.close ();"/>
</div>
</body>

Is that a section of code in the above code has a syntax error, as follows is a modified code snippet:
Success:function (JSON) {
var tablehtml = ";
...

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.