2011-12-05 54 views
0

我有这个jQueryjQuery的岗位不工作的方式,我期待与路径

$('.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发布不相对和使用完整的url我指定

回答

6

你错过了:http://

正确的版本:

var delete_location = 'http://<?php echo $_SERVER["SERVER_NAME"]; ?>?route=module/cart/delete_builder_step';