This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

phamvuduycuong15027
phamvuduycuong15027

Hi everyone, I need some help. I create a javascript code ( I call this is A), and a function call a form ajax request -> this will return true or false after ajax running( I call this is B). Now I want A run function B, and if B return true A will run function A.1 and false will run A.2. But I have a issue the B function it alway return false because it not return after ajax request. Thanks!

My code: function B(){ $('#form-information').request('onSubmitForm', { complete: function(data) { if(JSON.parse(data.responseText).success=="true") return true return false } }) return false; }

Last updated

Crazymodder
Crazymodder

Hi

What do you mean with: "not return after ajax request" ?

Regards Crazymodder

phamvuduycuong15027
phamvuduycuong15027

Crazymodder said:

Hi

What do you mean with: "not return after ajax request" ?

Regards Crazymodder

it mean it just return form function B(always return false) it not return after ajax complete.

Crazymodder
Crazymodder

You mean your ajax request is not posted? Did you try like explained in docu?

$('#form-information').request('onSubmitForm', {
    success: function(data) {
        console.log(data);
    }
})

Last updated

1-4 of 4

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.