$.getJSON('<?php echo $this->baseURL()?>/site/ajax/checkusername',
{username: $('#username').val()},
function(data)
{
if (data == "TRUE")
{
$("#available").text("This username is available!");
}
else
{
$("#available").text("This username is not available!");
}
}
);
返回的請求URL:
http://my.local/site/ajax/checkusername?username=sdfsdf
我想它的形式返回:
http://my.local/site/ajax/checkusername/username/sdfsdf
如何才能實現這一目標?
通過自己創建整個URL而不是傳入'username'作爲參數。 – Jon