return true or false for main function from sub function
Dear All
I am, using following function to validate captcha
calling
checkcaptchafill.php to check whether entered value and session value
No issue in getting the valuse / result of this ajax correctly..this part is running well
the value of ajax call is stored in
$('#captcharesultdiv')
I want to check text stored in of this DIV after (after comparing or validating the CAPTCHA entered
following ajax call does it well
- function formCheck(formobj){
- $('#captcharesultdiv').text('');
- var captcha= $("input[name=captcha]").val();;
- alert(captcha);
- var url= "checkcaptchafill.php";
- data = {
- captcha: captcha
- }
-
- $('#captcharesultdiv').load(url,data, checkcaptchavalid ) ;
-
- } ;
I tried
- $('#captcharesultdiv').load(url,data, checkcaptchavalid ) ;
function
checkcaptchavalid validates the CAPTCHA
however i want return false or true for main function :
formCheck
- function checkcaptchavalid()
- {
- var vld = $('#captcharesultdiv').text();
-
- alert("In Function="+vld);/* <-- getting correct value */
- if (vld==1)
- {
- return true; /*<- should be for main function formCheck(formobj)*/
-
-
- }
- else
- {
- $('#captchamessagediv').text('Pls Ente Correct CAPTCHA !!');
- $('#captchamessagediv').show();/* -> showing error workign correctly */
-
- }
- }