Here is my requirement, I have an array having datewise data like
$.each(dateWiseArr, function(index, currentDate){
myDateArray[currentDate] = "myData";
dateWiseOtherId[currentDate] = "otherId";
});
alert(myDateArray+"::"+dateWiseOtherId);//working fine and showing right data
$("#myBtn").attr("onClick", "myPassingFunction("+myDateArray+", "+dateWiseOtherId+")");
function myPassingFunction(myDateArray, dateWiseOtherId){
alert(myDateArray[0]);//throw undefined
}
Now when I am press my button function call successfully but variables becomes string.
Let me know if you need more understanding.
Note: myDate
clickevent. Look into a basic jQuery event tutorial - that will also solve your string issue.