Bug Tracker

Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#9763 closed bug (worksforme)

getJSON() doesn't execute callback function when formatted certain ways

Reported by: jeffzimmerlin@… Owned by:
Priority: low Milestone: 1.next
Component: ajax Version: 1.6.2
Keywords: Cc:
Blocked by: Blocking:

Description

This doesn't work:

$.getJSON("ForgotYourPassword.php", function() {

console.log("Won't be outputted");

});

but this does:

$.getJSON("ForgotYourPassword.php", login_forgotYourPassword2());

login_forgotYourPassword2=function() {

console.log("Will be outputted");

}

Change History (4)

comment:1 Changed 8 years ago by anonymous

Resolved.

JSON was improperly formatted.

comment:2 Changed 8 years ago by addyosmani

Component: unfiledajax
Priority: undecidedlow
Resolution: worksforme
Status: newclosed

As confirmed by the original ticket submitter, this issue has now been resolved. Marking as worksforme/user error.

comment:3 Changed 8 years ago by Rick Waldron

For good measure, the only reason your second example "worked" was because the function expression was being invoked with ()

comment:4 Changed 8 years ago by anonymous

Thank you! Apologies about the false alarm.

Note: See TracTickets for help on using tickets.