I am trying to apply ajax call for the response received from json.
Below my HTML.
<div id = "tabs">
<ul>
<li><A href="#ed_pro">Product Category</A> </li>
<li><A href="#ed_img">Add Image</A> </li>
<li><A href="#ed_txt">Add Text</A></li>
</ul>
<div id="ed_pro">
</div>
<div id="ed_img">
</div>
<div id="ed_txt">
</div>
</div>
and
function handleTabSelect(data) {
var items = '<ul>';
$.each(data, function(i, object) {
items += '<li><a id="main_cat" href=#>' + object.img_cat_des + '</a></li>';
});
items += '</ul>';
$('#ed_img').append(items);
flag = 1;
}
$('#main_cat').click(function() {
var url1 = $(this).attr("href");
alert(url1);
});
$("#tabs").tabs();
$("#tabs").bind("tabsselect", function(e, tab) {
if (flag == 0) {
jQuery.ajax({
type: 'POST',
url: '?q=design/lab_tab',
dataType: 'json',
data: 'slider_value=' + tab.index,
success: handleTabSelect,
error: function(xhr, status) {
alert(xhr.statusText);
}
});
}
});
After getting the response from json, the above script will append list of as
<ul>
<li>
<a id="main_cat" href="#">Animals</a>
</li>
<li>
<a id="main_cat" href="#">Astrology</a>
</li>
</ul>
How I can apply further ajax call for .
On clicking the a href, it never invokes
$('#main_cat').click(function () {
var url1 = $(this).attr("href");
alert (url1);
});
Thanks in advance.