使用ajax和php表单查询字符串

时间:2013-06-17 13:46:24

标签: php javascript html ajax

我在点击按钮时调用ajax函数。

$.ajax({
            type: 'GET',
            url: "javascript.php?orderid=CF450AA4",
            //data: "orderid=CF450AA4",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (msg, status) {
                alert("successful");
                console.log(msg);
            },
            error: function (msg, status) {
                console.log("failure");
                console.log(msg);
                alert("failure");
            }
        });
}

我有javascipt.php文件,其中代码是为服务器端编写的,并且工作正常。 我想重新编码。我希望当有人点击按钮时,url会更改为index.php?orderid = CF450AA4,结果将在变量中传递。怎么做

1 个答案:

答案 0 :(得分:0)

我这样做了..

location.hash = 'url';

希望对你有用..