Note that there are some explanatory texts on larger screens.

plurals
  1. POJQuery Ajax 500 Internal Error
    primarykey
    data
    text
    <p>I'm just starting to use the JQuery library so bear with me if I am missing something obvious. I have a webserivce with a couple of test methods...</p> <pre><code>[WebService(Namespace = "http://localhost/WebServices")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. [System.Web.Script.Services.ScriptService] public class SystemServices : BaseWebService { [WebMethod(EnableSession = true)] public string GetDate() { return DateTime.Today.ToShortDateString(); } [WebMethod(EnableSession = true)] public string PerformPISearch(string firstName, string lastName ) { return firstName + lastName; } </code></pre> <p>I can use the $.ajax request to use the GetDate method which does not have parameters with no issue, but I get the 500 Internal Server Error returned from jQuery when I try to run the PerformPISearch method (the web service constructor never gets hit)...So I am assuming I am doing something wrong with the way I am trying to pass the paramters to the method, but I can't figure out what...</p> <pre><code> function PerformSearch() { var strFirstName = (txtFirstName.GetValue() == null ? "" : txtFirstName.GetValue()); var strLastName = (txtLastName.GetValue() == null ? "" : txtLastName.GetValue()); var webserviceURL = '&lt;%= WebServiceURL %&gt;' $.ajax({ type: "POST", url: webserviceURL + "SystemServices.asmx/PerformPISearch", //Can change to use GetDate and it works. data: ({firstName: strFirstName, lastName: strLastName}), //thinking the problem is here contentType: "application/json; charset=utf-8", dataType: "json", success: function(msg) { AjaxSucceeded(msg); }, error: AjaxFailed }); } function AjaxSucceeded(result) { alert(result.d); } function AjaxFailed(result) { alert(result.status + ' ' + result.statusText); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload