2011-03-11 11 views
10

पता नहीं लगा सकता कि AJAX लोड किए गए रिकैप्चा को थीम कैसे करें। नीचे कोड काम नहीं करता है।
Google RecaptchaReCAPTCHA AJAX लोड विषय समस्या

देखा इस पोस्ट Recaptcha ajax API custom theme not working से, लेकिन मैं निश्चित रूप स्थानीय होस्ट और recaptcha में देखने हूँ ठीक काम कर रहा है, बस विषयों में बदलाव नहीं।

किसी को भी सलाह है कि सफेद थीम को काम करने के तरीके कैसे प्राप्त करें?

<script type='text/javascript'> 
     var RecaptchaOptions = { 
      theme : 'white' 
     }; 
    </script> 
    <div id="recaptcha_content"> 
     <noscript> 
     <iframe src="http://www.google.com/recaptcha/api/noscript?k=6Ldr7woAAAAAADa_69Mr-EZKAeYyEx9N08q" height="300" width="500" frameborder="0"></iframe><br /> 
     <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea> 
     <input type='hidden' name='recaptcha_response_field' value='manual_challenge' /> 
     </noscript> 
    </div> 
    <script type="text/javascript"> 
    $(document).ready(function() { 
     $.getScript('http://www.google.com/recaptcha/api/js/recaptcha_ajax.js', 
      function() {Recaptcha.create("6Ldr7woAAAAAADa_69Mr-EZKAeYyEx9N08q", "recaptcha_content"); 
     }); 

    }); 
    </script> 
+1

वाह पर सीधे विषय निर्धारित करते हैं, पहली बार मैं एक इनाम जारी किए गए हैं, क्या अच्छे नतीजे और जल्दी से। समस्या मिली और हां यह आसान था तो मैंने सोचा। हर किसी की मदद के लिए धन्यवाद। – jhanifen

+0

प्रश्न के लिए धन्यवाद। ऐसा लगता है कि यह इंटरनेट में पुराने reCaptcha v1 का उपयोग करने का एकमात्र उदाहरण है। – Kate

उत्तर

5

ऐसा नहीं लगता कि आप अपने विकल्पों को जोड़ रहे हैं जिन्हें आपने RecapthcaOptions सेट किया है। को बदलने का प्रयास करें:

$.getScript('http://www.google.com/recaptcha/api/js/recaptcha_ajax.js', 
     function() {Recaptcha.create("6Ldr7woAAAAAADa_69Mr-EZKAeYyEx9N08q", "recaptcha_content", RecaptchaOptions); 
}); 

See the doc's, तीसरे .create() विधि के लिए पारित विकल्प विकल्प है। आप विकल्पों को सेट करने के लिए फ़ंक्शन के बाहर एक चर सेट अप कर रहे हैं, लेकिन उन्हें शामिल न करें।

+0

धन्यवाद स्कूबलर, हाँ यह इतना आसान था। – jhanifen

+0

नहीं समस्या, मदद करने में खुशी हुई !! – Scoobler

+0

मैं हमेशा दस्तावेज़ों को पढ़ना भूल जाता हूं। आरटीएफएम! – Derek

5

@jhanifen: मैं इसे http://wiki.recaptcha.net/index.php/Installation से कोड के सबसे उपयोग करने के बाद काम कर रहा है, इस कोशिश -

<html> 
    <head> 
     <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script> 
    </head> 

    <body> 

    <script type="text/javascript"> 
    $(document).ready(function() { 
     $.getScript('http://www.google.com/recaptcha/api/js/recaptcha_ajax.js', 
      function() { 
       Recaptcha.create("6Ldr7woAAAAAADa_69Mr-EZKAeYyEx9N08q", 
       "recaptcha_content", 
       { 
        theme: "white", 
        callback: Recaptcha.focus_response_field 
       } 
      ); 
     }); 
    }); 
    </script> 

    <div id="recaptcha_content"> 
     <noscript> 
     <iframe src="http://www.google.com/recaptcha/api/noscript?k=6Ldr7woAAAAAADa_69Mr-EZKAeYyEx9N08q" height="300" width="500" frameborder="0"></iframe><br /> 
     <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea> 
     <input type='hidden' name='recaptcha_response_field' value='manual_challenge' /> 
     </noscript> 
    </div> 

    </body> 
</html> 
+1

धन्यवाद stealthyninja, यह बहुत अच्छा काम किया। आप या उपरोक्त उत्तर बहुत अच्छा होगा। – jhanifen

+0

लिंक मर चुका है :( – Shanimal

+0

@ सिंनिमल - https://developers.google.com/recaptcha/docs/display?csw=1#AJAX – stealthyninja

0

Occam है उस्तरा तरह से जा रहे हैं, आपको यह सत्यापित कर सकते हैं कि विषय स्थापित करने के लिए स्क्रिप्ट फॉर्म तत्व से पहले है। जैसा कि दस्तावेज़ों में कई बार कहा गया है, स्क्रिप्ट फॉर्म तत्व के अंदर या उसके बाद काम नहीं करती है।

1

सबसे पहले, आपकी कुंजी अमान्य या गलत है, या आप यहां पोस्ट करना चाहते थे: डी यदि नहीं चाहता था। एक नया पाने का प्रयास करें, और शायद इसे वैश्विक बनाएं (स्थानीयहोस्ट सामग्री को प्रभावित कर सकता है)। या आपके द्वारा निर्दिष्ट डोमेन पर कोड अपलोड और परीक्षण करें।

यह टुकड़ा मेरी वैश्विक सार्वजनिक कुंजी के लिए काम करता है, मैं सृजन

<html> 
<head> 
<title>recaptcha test</title> 
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script> 
<script type="text/javascript" src="http://www.google.com/recaptcha/api/js/recaptcha_ajax.js"></script> 
</head> 
<body>  
    <div id="recaptcha_content"> 
     <noscript> 
     <iframe src="http://www.google.com/recaptcha/api/noscript?k=publickey" height="300" width="500" frameborder="0"></iframe><br /> 
     <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea> 
     <input type='hidden' name='recaptcha_response_field' value='manual_challenge' /> 
     </noscript> 
    </div> 
    <script type="text/javascript"> 
    $(document).ready(function() { 
     Recaptcha.create("publickey", 
         "recaptcha_content", { 
          theme: "white", 
          callback: Recaptcha.focus_response_field 
     }); 
    }); 
    </script> 
</body> 
</html> 
+0

हाँ पोस्ट करने से पहले कुंजी को थोड़ा बदल दिया गया था। लेकिन यह मेरे उदाहरण के समान नहीं है, हालांकि दृष्टिकोण काम करता। – jhanifen

+0

I इस समाधान को सबसे अच्छा पसंद आया क्योंकि यह केवल ऑनलोड के लिए मदद के लिए jQuery का उपयोग कर रहा है। यह विधि आईफोन 3 जीएस के लिए भी काम करेगी, जब ' 'विधि हमेशा पहले जाने पर लोड नहीं होती है। – Reuben