weixin_33724570 2017-12-15 06:41 采纳率: 0%
浏览 47

如何在CS购物车中使用Ajax

<script>
function showHint(str) {

    if (str.length == 0) {
        document.getElementById("txtHint").innerHTML = "";
        return;
    } else {
        var xmlhttp = new XMLHttpRequest();
        xmlhttp.onreadystatechange = function() {
            if (this.readyState == 4 && this.status == 200) {
                document.getElementById("txtHint").innerHTML = this.responseText;
            }
        }
        xmlhttp.open("GET", "index.php?dispatch=paysrk.paymod?amount="+str, true);
        alert(+str);
        xmlhttp.send();
    }
}
</script> 

i think problem is here.Amount is not geting .url is not working.

index.php?dispatch=paysrk.paymod?amount

Question updates:- enter image description here

My requirements:

When i click the unsubscribe button status in the database change to "US" and change UNSUBSCRIBE button to SUBSCRIBE. A notification with unsubscription completed

  • 写回答

3条回答 默认 最新

  • weixin_33725515 2017-12-21 21:06
    关注

    i think your problem is in the url syntax.

    the first parameter to pass to the url is after ? and all the other parameters should preceded with & so your GET url should be like this

    index.php?dispatch=paysrk.paymod&amount
    
    xmlhttp.open("GET", "index.php?dispatch=paysrk.paymod&amount="+str, true);
    
    评论

报告相同问题?