第一种:

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);
        })
    };
}

 

相关文章:

  • 2022-12-23
  • 2021-05-08
  • 2021-11-10
  • 2022-01-31
  • 2022-01-23
  • 2022-01-06
  • 2022-12-23
猜你喜欢
  • 2021-07-31
  • 2022-12-23
  • 2022-01-25
  • 2022-12-23
  • 2021-12-26
  • 2022-01-30
  • 2022-01-29
相关资源
相似解决方案