| | |
how to call server side method from jquery
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jul 2008
Posts: 66
Reputation:
Solved Threads: 6
Hi All,
I'm new to this jquery and i found some article, implemented but its server side method is not firing. Plz if you know help out this probelm.
These is the code implemented in my application in jquery side.
and server side is
Im not geting the breakpoint. Plz let me know if u have any idea.
I'm new to this jquery and i found some article, implemented but its server side method is not firing. Plz if you know help out this probelm.
These is the code implemented in my application in jquery side.
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<script type="text/javascript" ></script> <script language="javascript"> $(document).ready(function() { $("#btnClick").click(function() { var email = $("#txtemail").val(); $.ajax({ type: "POST", url: "TestingEmail.aspx/DNSValidation", data: "{EmailAddress:" + email.toString() + "}", success: function(response) { alert(response.d); // if (response.bolDNSFlag != "true") { // alert("Plz try again"); // $("#txtemail").focus(); // } }, error: function() { alert("Error"); } }); //Call the PageMethods $.ajax(options); }); }); </script>
and server side is
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
[WebMethod] public static string DNSValidation(string EmailAddress) { Boolean bolDNSFlag = false; try { if (isEmail(EmailAddress.Trim())) { string[] host = (EmailAddress.Trim().Split('@')); string hostname = host[1]; IPHostEntry IPhst = Dns.GetHostEntry(hostname); IPEndPoint endPt = new IPEndPoint(IPhst.AddressList[0], 25); Socket s = new Socket(endPt.AddressFamily, SocketType.Stream, ProtocolType.Tcp); s.Connect(endPt); bolDNSFlag = true; } } catch (Exception exp) { bolDNSFlag = false; } return bolDNSFlag.ToString(); }
Im not geting the breakpoint. Plz let me know if u have any idea.
signOut
•
•
Join Date: Oct 2009
Posts: 102
Reputation:
Solved Threads: 18
0
#2 Oct 20th, 2009
Fist (in FireFox) press CTRL + SHIFT + J and load the Error console. Clear the contents before you reload the page. When you reload the page, if errors appear, fix them.
Is the call jquery ajax call being made? If you're using firefox, install the firebug extension. This extension will allow you to look at the ajax calls that are being made. It will make it easier for you to debug.
Also, jQuery offers a much simpler construct for ajax.
Also, I think you may be quoting the wrong parts in the data variable. Not sure on that, the error console will help you out there.
Is the call jquery ajax call being made? If you're using firefox, install the firebug extension. This extension will allow you to look at the ajax calls that are being made. It will make it easier for you to debug.
Also, jQuery offers a much simpler construct for ajax.
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
jQuery.post( "TestingEmail.aspx/DNSValidation", {"EmailAddress": email.toString()}, function(data){ alert(data); });
Also, I think you may be quoting the wrong parts in the data variable. Not sure on that, the error console will help you out there.
![]() |
Similar Threads
- Calling C# function through Javascript in ASP.NET (ASP.NET)
- Adjusting Code to use either server-side or client-side validation--NOT BOTH (JavaScript / DHTML / AJAX)
- How to call jsp use bean method inside javascript (JavaScript / DHTML / AJAX)
- Client side Javascript function does not work in server side call (JavaScript / DHTML / AJAX)
- Calling C# From JS (C#)
- How To Send Data From Client To Server via Server Side (using C# TCP Socket) ? (C#)
- How can I work server side without refreshing web pages (ASP.NET)
- HTML and Server Side Includes (HTML and CSS)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Anyone see why this isn't working for IE?
- Next Thread: Please explain the codes
| Thread Tools | Search this Thread |
Tag cloud for JavaScript / DHTML / AJAX
ajax ajaxcode ajaxexample ajaxjspservlets api blackjack browser bug calendar captchaformproblem checkbox child class close cookies createrange() cursor date debugger dependent developer disablefirebug dom dropdown editor element embed engine events explorer ext file firehose flash form forms game getselection google gxt hiddenvalue highlightedword hint html ie7 ie8 iframe image() images internet java javascript javascripthelp2020 jquery jsf jsfile jump libcurl math matrixcaptcha media object onerror onmouseoutdivproblem onreadystatechange parent paypal pdf php position post programming progressbar rated regex runtime scriptlets scroll search security session shopping size software sql star stars stretch synchronous text textarea tweet unicode variables web webservice window windowsxp wysiwyg \n





