Reputation: 211
I've integrated the Charisma V.2.0.0 bundle in an ASP.Net C# application. All looks good until I write an .ajax call to a web service. Ajax call, a standard format, works in a basic asp.net page, but from the bundle. It seems like something in his 'bower_components'. I removed reference to bower_components/jquery and am including ajax.googleapis.com... 3.3.1.
Does anyone have experience with this problem? and what might be a solution? I like the UI Muhammad designed and would like to keep developing which is platform.
The axax call looks like this:
// Edit Client button
$(document).on("click", "[id*=btnEditClient]", function () {
// Edit selected client/Event Id - get data from Ajax
//alert($(this).val());
var clientId = $(this).val();
var clientInfo = JSON.stringify({ clientId: clientId });
alert(clientInfo);
$.ajax(
{
url: '<%= ResolveUrl("QRWebService.aspx/GetClientListService") %>',
type: "POST",
data: clientInfo,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (result) {
// results
alert(result.d);
alert('no error ' + JSON.stringify(result));
$("#myModal").modal()
return true;
},
error: function (jqXHR, textStatus, errorThrown) {
alert('error: ' + textStatus);
}
});
return false;
})
and the result is 'undefined' where the web service never gets called.
The web serivce is:
[WebMethod]
public static DataSet GetClientListService()
{
// returns dataset LIST of Client Id and Name
DataSet ds = new DataSet();
SQLHelper.SqlQuery oQuery = new SQLHelper.SqlQuery();
String strSQL;
try
{
strSQL = "SELECT Clients.ClientId, ClientName FROM Clients ";
strSQL += "WHERE ClientActive=@clientActive";
ds = oQuery.GetDataSet(strSQL);
} catch(Exception ex){
errorMessage = ex.Message;
}
return ds;
} // end GetClientEventList()
Upvotes: 1
Views: 35
Reputation: 211
Post ASP.NET Calling WebMethod with jQuery AJAX "401 (Unauthorized)". Changing the App_Start from Permanent to:
settings.AutoRedirectMode = RedirectMode.Off;
did the trick. I hope this helps others. Thank you StackOverflow and all those who post solutions to tricky issues.
Upvotes: 1