Sample Code:
<img id="image" onclick="addDetails('1','2','3');" src="sample.png"/>
<script>
function addDetails(data1,data2,data3)
{
$.ajax(
{
.....
.....,
success: function()
{
document.getElementById("image").onclick=function onclick(event){deleteDetails('data1','data2','data3');};
}
});
}
</script>
In the above sample code i am making an ajax call on click of image and after successchanging the onclick function to deleteDetails. Both the functions addDetails and deleteDetails have same value as their parameter. so in the onclick function am trying to set the deleteDetails with the same parameters as of the called method.
The problem here is when i debugged it the actual function which binded with the onclick function is deleteDetails('data1','data2','data3') insted of deleteDetails('1','2','3') . I tried all the possible string operators to print the value but its not happening.