【发布时间】:2013-12-23 00:23:01
【问题描述】:
我在让我的 jquery 函数从我的输入 html 表单元素中获取我的数据时遇到了一些问题。
这是我的 javascript:
<script>
$(function(){
$('#estimate').click(function() {
var postcode_entry = $('#postcode_entry').value;
$("#shipping_method").html("<div style=\'margin:20px auto;width:100px;text-align:center;\'><img src=\'ext/jquery/bxGallery/spinner.gif\' /></div>").show();
$.get("checkout_shipping.php", {country: "38", refresh_quotes: "1", postcode: postcode_entry, zone_name: "canada" },
function(data){
$("#shipping_method").html(data);
}
);
});
});
</script>
html:
<input type="text" name="postcode" id="postcode_entry" />
<button type="button" id="estimate" >Estimate..</button>
我无法将 postcode_entry 数据导入函数。如果我硬编码邮政编码,那么它可以正常工作。
【问题讨论】:
标签: javascript jquery html