presubmite

presubmite

THEJASVITHEJASVI Posts: 31Questions: 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: 31Questions: 9Answers: 0
    edited October 2018

    pre-submite event

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

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @THEJASVI ,

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

    Cheers,

    Colin

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 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

This discussion has been closed.