开发者

jQuery get and response to html, POST problem after that

开发者 https://www.devze.com 2022-12-08 02:01 出处:网络
I have the follow开发者_JAVA技巧ing function: jQuery(document).ready(function($){ $(\"div.findButton\").click(function(){

I have the follow开发者_JAVA技巧ing function:

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);
   });
  });
 });

example content of the jQuery response:

<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>

everything works fine and it displays the results, but when I hit the submit button, it post the values from the jQuery response fields only in IE8. I try on FF, Opera, Chrome and Safari, but they all not return the values from the jQuery response fields.

Someone having same problem? Or any solution?

Thanks in advance!


Try to use:

$.post("result.php", {postcode: PostCode,uid:UidID}, function(response){
  $("#result").html(response);
}, "json");
0

精彩评论

暂无评论...
验证码 换一张
取 消