I am trying to pass an object as parameter to the javascript function as:
.html('<span class="link" onclick="javascript:ShowEventDetails(' + event + ','
+ event.Id + ',' + event.Name + ',' + view + ')">' + event.title
+ '</span>')
In the above js, the event and view are objects from the jquery calendar Full Calendar, which i am passing to call a js function.
It throws an error, Expected ']'. What may be problem or how to pass an object as above?
It shows "javascript:ShowEditEventDetails([object Object],1,'Name',[object Object])" while looking in firebug.
You can’t pass an object in that way, because when you concatenate the HTML string of your
spanelement, all the operands of the+operator are convertedtoString, including theeventobject, that’s why you get"[object Object]":I would recommend you to bind the click event programmatically: