| Author: Priya 05 Sep 2008 | Member Level: Silver | Rating: Points: 1 |
Ask something specific about jquery. Let us know what is the exact problem your facing and where you need help.
|
| Author: Raju.M 05 Sep 2008 | Member Level: Gold | Rating: Points: 6 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> New Document </TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT=""> <SCRIPT LANGUAGE="JavaScript" src="jquery-1.2.6.min.js"></SCRIPT> <SCRIPT LANGUAGE="JavaScript" src="jquery.corner.js"></SCRIPT> <SCRIPT LANGUAGE="JavaScript"> <!-- $(document).ready(function(){ $('#as').corner(); $('#as').fadeOut(550).fadeIn().fadeOut(550).fadeIn().fadeOut(550).fadeIn() }) //--> </SCRIPT> </HEAD>
<BODY> <div id="as" style="background-color: red;width:100px;height:100px"></div> </BODY> </HTML>
|
| Author: Shiva 08 Sep 2008 | Member Level: Bronze | Rating: Points: -20 |
Hi, This is my code ..........not working gve me then solution.... This will be our page method for the example:
public partial class _Default : Page { [WebMethod] public static string GetDate() { return DateTime.Now.ToString(); } }
Calling the page method with jQuery instead.
Corresponding to the example page method above, here’s our Default.aspx:
<html> <head> <title>Calling a page method with jQuery</title> <script type="text/javascript" src="jquery-1.2.6.min.js"></script> <script type="text/javascript" src="Default.js"></script> </head> <body> <div id="Result">Click here for the time.</div> </body> </html>
As you can see, there’s no ScriptManager required, much less EnablePageMethods.
As referenced in Default.aspx, this is Default.js:
$(document).ready(function() { // Add the page method call as an onclick handler for the div. $("#Result").click(function() { $.ajax({ type: "POST", url: "Default.aspx/GetDate", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", success: function(msg) { // Replace the div's content with the page method's return. $("#Result").text(msg.d); } }); }); });
Thanks Inadvance..
New Text Document.txt |