| | |
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: 65
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: 99
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 |
acid2 ajax ajaxcode ajaxexample ajaxhelp ajaxjspservlets animate automatically beta box browser bug calendar captchaformproblem checkbox child class close column createrange() css cursor decimal dependent design disablefirebug dom download dropdown editor element embed engine error events explorer ext file form forms google gwt gxt hiddenvalue highlightedword html htmlform ie8 iframe images index internet java javascript javascripthelp2020 jawascriptruntimeerror jquery jsf jsfile jump libcurl listbox math media microsoft mimic mp4 object onmouseoutdivproblem onmouseover onreadystatechange parent paypal pdf php player post problem progressbar regex runtime scroll search security select shopping size software sql text textarea unicode w3c web website window windowofwords windowsxp wysiwyg \n





