3
我有一個HTML文件,其URL爲localhost/dir1/dir2/file.html
。在這個文件中,我通過jquery將數據發送到服務器。使用jQuery將數據發送到絕對URL
$('#element').live("change", function(){
$.ajax({
url: "localhost/dir1/dir3/file.php",
type: "POST",
data: { esp: $(this).val() },
success: function(result){
$("#element2").html(result);
}
})
我得到一個錯誤,因爲jQuery的數據發送到localhost/dir1/dir2/localhost/dir1/dir3/file.php
但我需要將數據發送到localhost/dir1/dir3/file.php
。 我該怎麼做?
你有沒有嘗試將協議添加到你的網址? 'url:「http://localhost/dir1/dir3/file.php」'? ('http://'部分) – jmbertucci 2013-05-09 19:21:42