jQuery的AJAX示例

	var textRet;
	var textJson;
	var textUrl;
	var timeoutMS;
	$.ajax( {
		type : 'POST',
		data : textJson,
		url : textUrl,
		dataType : 'json',
		timeout : timeoutMS,
		success : function(jsonRet) {
			//do something here
			textRet=...;
		},
		error:function(jqXHR, textStatus, errorThrown) {
			if(textStatus==='error') {
				//do something here
				textRet=...;
			}
			if(textStatus==='timeout') {
				//do something here
				textRet=...;
			}
                }
	});

Comments are closed.