2011-12-05 28 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';