views:

26

answers:

2

Hello, I'm using jQuery UI Tabs, and am using the sample code:

$(function() {
    $("#tabs").tabs({
        ajaxOptions: {
            error: function(xhr, status, index, anchor) {
                $(anchor.hash).html("Couldn't load this tab. We'll try to fix this as soon as possible. If this wouldn't be a demo.");
            }
        }
    });
});

The issue here is I want to capture an AJAX success to grab a JSON object in inject the data into the DIV...

But this isn't working

$(function() {
        $("#tabs").tabs({
            ajaxOptions: {
                success: function(xhr, status, index, anchor) {
                    alert('hello world');
                },
                error: function(xhr, status, index, anchor) {
                    $(anchor.hash).html("Couldn't load this tab. We'll try to fix this as soon as possible. If this wouldn't be a demo.");
                }
            }
        });
    });

Ideas?

Thanks

A: 

If you copy & pasted, you're missing a comma after the success function before 'error'.

Nija
Sorry I have the comma, is still does nothing
Is it doing nothing when you add the success section, or still running the error?Use FireBug to see what URL is being requested for the content and making sure that's correct - Or even if the ajax request is being made. Could help narrow down where the problem is.
Nija
A: 

Are you missing a comma before closing success function or is it a typo?

ajaxOptions: {
            success: function(xhr, status, index, anchor) {
                alert('hello world');
            },
            error: function(xhr, status, index, anchor) {
                $(anchor.hash).html("Couldn't load this tab. We'll try to fix this as soon as possible. If this wouldn't be a demo.");
            }
        }

EDIT: Sorry, late answer

xPheRe