我有以下功能:
jQuery(document).ready(function($){
$("div.findButton").click(function(){
UidID=Math.floor(Math.random()*1000);
PostCode=$("#postcode").val();
$.get("result.php", {postcode: PostCode,uid:UidID}, function(response){
$("#result").html(response);
});
});
});
jQuery响应的示例内容:
<table cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr>
<td class="left">Address:</td>
<td class="right"><select class="tselect" name="address">
<option value="80A Town Street">80A Town Street</option>
<option value="102 Town Street">102 Town Street</option>
</select>
</td>
</tr>
<tr>
<td class="left" />
<td class="right"><input class="tinput" type="text"
value="Horsforth" name="address1" />
</td>
</tr>
<tr>
<td class="left">Town:</td>
<td class="right"><input class="tinput" type="text"
value="Leeds" name="town" />
</td>
</tr>
<tr>
<td class="left">County:</td>
<td class="right"><input class="tinput" type="text"
value="West Yorkshire" name="county" />
</td>
</tr>
</tbody>
</table>
一切正常并显示结果,但是当我点击提交按钮时,它仅在IE8中发布jQuery响应字段中的值。我尝试使用FF,Opera,Chrome和Safari,但它们都没有返回jQuery响应字段中的值。
有人遇到同样的问题吗?或任何解决方案?
提前致谢!
答案 0 :(得分:3)
尝试使用:
$.post("result.php", {postcode: PostCode,uid:UidID}, function(response){
$("#result").html(response);
}, "json");