我想将以下jQuery代码转换为Ajax是否可能?
<script type="text/javascript">
$j(document).ready(function () {
$j("#co-shipping-method-form .buttons-set button.button").click(function () {
var shippingSelectedValue = $j("input[name='shipping_method']:checked").val();
if(shippingSelectedValue == 'freeshipping_freeshipping' ){
$j("#customtest_modal_id").show();
}
});
$j("a.reset-customtest").click(function () {
$j("#customtest_modal_id, #checkout-step-shipping_method").show();
$j("#checkout-step-payment").hide();
});
});
</script>
答案 0 :(得分:0)
我认为你误解了AJAX的概念。
以下是AJAX可以为您做的事情: - 在页面加载后从Web服务器读取数据 - 无需重新加载页面即可更新网页 - 将数据发送到Web服务器 - 在后台
简而言之,AJAX是一种通过XML传输数据的方式
答案 1 :(得分:0)
哦,我明白了。 首先,您需要使用逻辑定义一个函数,例如
function clickButtonSet() {
//you code here
}
然后,在你的html中,你将一个动作点击进入.button-set
<button class="button-set" onclick="clickButtonSet()"> Click Me </button>
与按钮.reset-customerset
相同尝试一下:)