2015-06-01 74 views
2

我有我的index.php頁面上此代碼:改變jQuery的加載頁面URL

$('.EditCustomer').load("page1.php"); 

<select name="date" id="date" class="form-control"> 
...options here... 
</select> 

然後我有這個上page1.php應該改變page1.phppage1.php?date=1234

$(document).ready(function() { 
     $('#date').on('change', function() { 
      $('.EditCustomer').load("page1.php?date=" + $(this).val()); 
      alert($(this).val()); 
     }); 
    }); 

但它沒有這樣做因爲它找不到.EditCustomer div

我該如何改變page1.php?

回答

0

可以使用歷史記錄對象更改URL:

Manipulating the history/url of page

history.replaceState(null, null, "page1.php?date=" + $(this).val()); 

雖然我不知道這是你在找什麼。