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,177Questions: 1Answers: 2,590

    Hi @THEJASVI ,

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

    Cheers,

    Colin

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 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.