Cannot reach web method with Flexigrid call from aspx page
I implemented the followig web method (file Notes.asmx):
[WebMethod(EnableSession = true)]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public object getNotesData ()
{
Guid contactId = new Guid("dc53b9a3-bde1-4810-88dd-3db2581f29b8");
var data = BusinessObjectFactory.GetContactNotes(contactId);
string serialized = new JavaScriptSerializer().Serialize(data);
return serialized;
}
The method simply return some data referred to a contact. I tested the method separately and it returns the records properly.
In an aspx page I use the following Flexigrid syntax to call this web method for retrieve the data:
$(function ()
{
$("#flex1").flexigrid(
{
开发者_如何学编程url: 'WebService/Notes.asmx/getNotesData',
dataType: 'json',
colModel : [
{ display: 'NOTEID', name: 'NOTEID', width: 40, sortable: true, align: 'left' },
{ display: 'Title', name: 'Title', width: 150, sortable: true, align: 'left' }
],
sortname: "Title",
sortorder: "asc",
usepager: true,
title: "Notes_TITLE",
useRp: true,
rp: 10,
showTableToggleBtn: false,
resizable: false,
width: 500,
height: 370,
singleSelect: true
}
);
});
However debugging the code I see that the server is never reached from the flexigrid call. In the browser the aspx page has a "Connection Error" in the Flexigrid UI.
I use other web methods invoked with Ajax/Json and jQuery and they work fine. It is not a matter of wrong path since the aspx file is saved on the same server and in the directory above the one containing the web service (folder called WebService).
Any suggestions why I cannot reach the server using Flexigrid sintax?
are you sure the path to your web service is WebService/Notes.asmx/getNotesData? have a look with firebug, it's probably the wrong url
精彩评论