当我通过 javascript/jquery 单击按钮时,我想触发此方法
这是我的网络方法,
[WebMethod]
public static string haldlescrolling(string name, string address)
{
String str = string.Empty;
httpWebRequest2 = (HttpWebRequest)WebRequest.Create("http://ws.vidlib.com/video/list");
httpWebRequest2.ContentType = "application/json";
httpWebRequest2.Method = "POST";
int start1 = start + 10;
using (var streamWriter = new StreamWriter(httpWebRequest2.GetRequestStream()))
{
int max1 = max + 10;
max = max + 10;
string more = "{\"StartRowIndex\":\"" + start + "\",\"MaximumRows\":\"" + max + "\"}";
// string json2 = js + more;
streamWriter.Write(more);
streamWriter.Flush();
streamWriter.Close();
var httpResponse = (HttpWebResponse)httpWebRequest2.GetResponse();
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
string result = streamReader.ReadToEnd();
l1 = (List<Test>)Newtonsoft.Json.JsonConvert.DeserializeObject(result, typeof(List<Test>));
for (int i = 0; i < l1.Count; i++)
{
str = str + "<img src='https://s3.amazonaws.com/movingmediapurchase/thumbnail/48748.jpg' />";
string video_id = l1[i].ClipId.ToString();
str = str + "<div id='parent' style=\"position:relative; float:left; text-align: top;\" onmouseover='callMouseOver(\"" + video_id + "\")' onmouseout='callMouseOut(\"" + video_id + "\")' ><a href='" + l1[i].PreviewUrl.ToString() + "' class='html5lightbox' data-width='450' data-height='350'><img src='" + l1[i].ThumbnailUrl.ToString() + "' class ='thumbnail'/></a><div id='" + video_id + "' style='display: none;position: absolute; z-index:10000; top: 110px; left:30px ; height: 34px;'><img src='tweetbutton.png'/><img src ='small-facebook-like-butto.gif' /><img src='pinit-button.png' /></div></div>" + " ";
/*
Label1.Text = l1.Count.ToString();
Image1.ImageUrl = l1[0].ThumbnailUrl.ToString();
Label1.Text = l1[0].ThumbnailUrl.ToString();
*
*/
}
}
}
return str;
}
如何创建javascript方法来调用上述方法背后的代码?