presubmite

presubmite

THEJASVITHEJASVI Posts: 26Questions: 9Answers: 0

$.ajax({
type: "GET",
data: {"domain":domain.val()},
dataType: "json",
url: '/example/',
cache: false,
timeout:30000,
success: function(returnData) {
console.log(returnData)
console.log("yes")
// domain.error( 'Domain must be valid URL' );
}
});

if ( this.inError() ) {
return false;
}

i m using this in presubmite evevnt but this.inError() execute first before ajax sucess what do ?

Replies

  • THEJASVITHEJASVI Posts: 26Questions: 9Answers: 0
    edited October 16

    pre-submite event

    if ( this.inError() ) {
    return false;
    }
    how to set true after return false

  • colincolin Posts: 2,774Questions: 0Answers: 483

    Hi @THEJASVI ,

    Yep, it's asynchronous, so the code carries on. You could move your check to postSubmit, perhaps,

    Cheers,

    Colin

  • allanallan Posts: 48,301Questions: 1Answers: 6,970 Site admin

    As on Editor 1.8 you can actually return a promise from the pre* event handlers, to cause them to "pause" until you complete the promise.

    Allan

Sign In or Register to comment.