第一种:
function engline(){
var oldmsg = $('#lineso').val()
if(oldmsg == null || oldmsg == '' || oldmsg == undefined){
alert('input content Please')
}else{
//alert(oldmsg)
$.ajax({
url:"http://127.0.0.1:8888/engline",
data : {'msg':oldmsg},
type : 'GET',
timeout : 3000,
// 成功回调
success: function(data){
if(data){
$('#linest').val(data)
}else{
alert('not result')
}
},
//失败回调
error: function(XMLHttpRequest, textStatus, errorThrown){
//查看错误信息
alert(XMLHttpRequest.status);
alert(XMLHttpRequest.readyState);
alert(textStatus);
}
})
};
}
第二种:
function engline(){
var oldmsg = $('#lineso').val()
if(oldmsg == null || oldmsg == '' || oldmsg == undefined){
alert('input content Please')
}else{
//alert(oldmsg)
$.ajax({
url:"http://127.0.0.1:8888/engline",
data : {'msg':oldmsg},
type : 'GET',
timeout : 3000,
//成功回调
}).done(function(data){
if(data){
$('#linest').val(data)
}else{
alert('not result')
}
//失败回调
}).fail(function(XMLHttpRequest, textStatus, errorThrown){
alert(XMLHttpRequest.status);
alert(XMLHttpRequest.readyState);
alert(textStatus);
})
};
}