ajax请求SyntaxError:missing;

时间:2017-03-12 23:57:26

标签: javascript jquery ajax

好吧我想通过javascript控制台运行这个我通过

安装Jquery
var script = document.createElement('script');
script.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(script);

并获取SyntaxError:missing;在陈述错误之前

function SolveRecaptchaV2(APIKey, googleKey, pageUrl){
        var requestUrl = "http://2captcha.com/in.php?key=" + APIKey + "&method=userrecaptcha&googlekey=" + googleKey + "&pageurl=" + pageUrl;

        $.ajax({url: requestUrl, success: function(result){
            if(result.length < 3){
                return false;
            }else{
                if(result.substring(0, 3) == "OK|"){
                    var captchaID = result.substring(3);

                    for(var i=0; i<24; i++){
                        var ansUrl = "http://2captcha.com/res.php?key=" + APIKey + "&action=get&id=" + captchaID;   

                        $.ajax({url: "ansUrl", success: function(ansresult){
                                if(ansresult.length < 3){
                                    return ansresult;
                                }else{
                                    if(ansresult.substring(0, 3) == "OK|"){
                                        return ansresult;
                                    }else if (ansresult != "CAPCHA_NOT_READY"){
                                        return ansresult;
                                    }
                                }
                            }
                        });
                         await sleep(5000);
                    }

                }else{
                    return ansresult;   
                }
            }
        },
        fail: function(){
            return "";
            }
        });

    }

0 个答案:

没有答案