开发者

Bing detect method and Jquery

since Google translate api will stop working i'm trying to implement some jquery code to translate text, but i can't make it working One simple example of this api is here

As you can see the return result is a string with the language that is detected. Τhis is my code, should i try a post/get method? I'm really confused with this stuff

$(document).ready(function() {
    $.ajax({
        url: "http://api.microsofttranslator.com/v2/ajax.svc/Detect?appId=xxxxxxxxxxxxxxxxxxxxx开发者_如何学编程xxx&text=A+hola+muchos",
        data: msg,
        success: function(msg){
            alert( msg);
        }
    });
});


i have managed to make it work :) For anyone who eve wants to use this try out:

var p = {};
p.appid = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
p.text = t;
$.ajax({
    url: 'http://api.microsofttranslator.com/V2/Ajax.svc/Detect',
    data: p,
    dataType: 'jsonp',
    jsonp: 'oncomplete',
    jsonpCallback: 'ajaxTranslateCallback',
    success: function(data, status) {
        alert(data);
    }
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜