How to select a another tab when jquery response using ajax
When form fade out then select another tab which is also jquery tab
$.ajax({
url: url_string,
//GET method is used
type: "POST",
//pass the data
data: data_string,
//Do not cache the page
cache: false,
//success
success: function (html) {
//if process.php returned 1/true (send mail success)
if (html != "") {
//hide the form
$('.form').fadeOut('slow');
// here the function is not working...
$(function 开发者_Go百科() {
$("#tabmenu").tabs("#content", {
effect: 'ajax',
current: 'active',
initialIndex: 1
});
});
} else {
alert('Sorry, unexpected error. Please try again later.');
return false;
}
}
});
$(function () {
$("#tabmenu").tabs("#content", {
effect: 'ajax',
current: 'active',
initialIndex: 1
});
});
Change your code from that above to that below.
$("#tabmenu").tabs("#content", {
effect: 'ajax',
current: 'active',
initialIndex: 1
});
I guess it can't fire your tabs because the DOM, in this very moment, is loading.
精彩评论