當我通過ajax發佈我有時會得到額外的字符發佈例如。如果文本通過AJAX雖然喲PHP $ _POST我最終得到:jquery發佈錯誤文本時,發佈與ajax
這是我messagejQuery127638276487364873268_374632874687326487的職位雖然經過精細的時間
99%......我不知道該如何捕獲並移除此錯誤,因爲它只發生在某些時間。
// this is the ajax that we need to post the footprint to the wall.
$('#submitbutton').click(function() {
var footPrint = $('#footPrint').val();
var goUserId = '1';
$.ajax({
type: 'POST',
url: '/scripts/ajax-ProfileObjects.php',
data: 'do=leave_footprint&footPrint=' + footPrint + '&ref=' + goUserId + '&json=1',
dataType: 'json',
success: function(data){
var textError = data.error;
var textAction = data.action;
var textList = data.list;
if (textError == 'post_twice' || textError =='footprint_empty' || textError == 'login_req') {
// display the error.
} else {
// lets fade out the item and update the page.
}
});
return false; });
您需要發佈您的代碼或示例才能獲得答案。 – j08691 2012-03-24 19:54:54