Here, I want to have both dynamic div and dynamic button associated with together, should work. I have tried lot of approaches, but I couldn't get what come wrong here. Below is function that I have used for my code. Please help me.
$(function(){
var count = 0;
$("#dygraphchartbutton").click(function(event){
var formURL = "<%=request.getContextPath()%>/DygraphPlot";
//event.preventDefault();
console.log("Submitting Data");
var formData=$("#history_form").serialize();
console.log(formData);
$.ajax({
type:'post',
url:formURL,
data:$("#history_form").serialize(),
success: function(data){
//alert(data);
//var str=JSON.parse(data);
console.log(data);
appendStr=data;
$("")
$("#report").append("<div id = 'dyplot"+count+"' style = \"float:left;z-index:1;\">"+appendStr+"<br><button onclick='showFullScreen()' id = 'fs"+count+"'>FullScreen</button><button onclick='exitFullScreen()' id = 'nfs"+count+"'>Exit</button></div>");
mainDiv = $("#dyplot"+count);
count++;
}
});
});
});
//display
function showFullScreen() {
mainDiv.addClass("fullscreen");
$('#fs0').show();
$('#nfs0').show();
}
function exitFullScreen() {
mainDiv.removeClass("fullscreen");
$('#nfs0').show();
$('#fs0').show();
}