Modify ↓
Ticket #10404 (closed bug: invalid)
Cannot use global variables?
| Reported by: | r.haeder@… | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | None |
| Component: | ajax | Version: | 1.6.4 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
Hi,
I have the following (example) code to explain my trouble
var isFooRequested = false;
function requestFoo () {
// By default nothing is requested
this.isFooRequested = false;
$.ajax({
url: 'ajax.php',
type: 'POST',
data: 'foo=foo',
dataType: 'json',
async: false,
success: function (ajax_content) {
// Do something here with the content
// Set it, because foo has been requested
this.isFooRequested = true;
},
error: function (ajax_content) {
// Do something with the error here, but do not change isFooRequested
}
});
// This does never return true, even on 'success' of foo-request
return this.isFooRequested;
}
I also tried to rewrite it to setter/getter and used explicit but it doesn't work either. So what do I do wrong?
Regards, Roland
Change History
comment:1 Changed 20 months ago by rwaldron
- Priority changed from undecided to low
- Resolution set to invalid
- Status changed from new to closed
- Component changed from unfiled to ajax
comment:3 Changed 20 months ago by r.haeder@…
It might not be a direct bug in jQuery, okay. But it looks like a bug to a user (which I am of jQuery). So please just let me know what is wrong here. Then I don't need to register for a single question. :(
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

This is not a bug in jQuery, please post support questions on the forum.