我有这个jquery
$('.delete_step').live('click', function(e) {
e.preventDefault();
var delete_location = 'http//<?php echo $_SERVER["SERVER_NAME"]; ?>?route=module/cart/delete_builder_step';
console.log(delete_location);
var response = confirm("Are you sure you want to delete this step?");
if(response){
$.post( delete_location, { step_id: $(this).attr("rel"), builder_id: "<?php print $builder_id; ?>" },
function(result) {
// window.location.reload();
});
}
});
所有看起来都不错,然后在我的控制台中我得到了这个
http//localhost?route=module/cart/delete_builder_step
这是正确的,但帖子正在这里
http://localhost/shop_pos/admin/http//localhost?route=module/cart/delete_builder_step
有没有办法使用jQuery帖子不是相对的,并使用我指定的完整网址
答案 0 :(得分:6)
您错过了:
中的http://
。
正确的版本:
var delete_location = 'http://<?php echo $_SERVER["SERVER_NAME"]; ?>?route=module/cart/delete_builder_step';