2009-10-15 20 views
0

我有以下功能:jQuery的響應jQuery的獲取和響應HTML,POST問題之後

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

例如內容:

<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

是否有可能在發佈的形式HTML的休息嗎?這可能是類似IE中的惡意表單標籤解析 – Deeksy

回答

3

嘗試使用:

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