Continuing from this post of mine passing id to ajax call
There is still something I would like to understand more.
My problem is like this
I have 2 pages (default.cshtml+click.cshtml)
In default.cshtml, I have a js code to initialize a div region with its id some image. When I click the link as mentioned in my previous post I need to change the image in this region because the new image is loaded from the database. Each image is associated with an assigned id; now that I don't know how or where I should put this initialize
script because it is used by both default and click pages
function init(id)
{
//...initialize options
var id=document.GetElementByID("displayimg");
//...display image
}
How can I implement the success handler in java script that has 2 or more parameters ?
$(document).ready(function ()
{
$('.viewp').click(function ()
{
var responseUrl="~/click?id="+id;
$.ajax(
{
type: "GET",
data:id,
url:responseUrl,
success:function(data1, data2)
{
}
});
});
});
because the click.cshtml will query the database table for 2 more data values to redisplay the image, it is its new width and height :-D