jQWidgets Forums
Forum Replies Created
Viewing 1 post (of 1 total)
-
Author
-
April 4, 2017 at 8:33 am in reply to: Retrieving JSON from ASMX Web Service Retrieving JSON from ASMX Web Service #92654
Ok so I fixed the issue:
Removed the Decoration: UseHttpGet = true from the Web Method
Used JQuery AJAX Call to retrieve Data:
$.ajax({ type: 'POST', url: '../Services/SMMDataManagement.asmx/GetFileData', data: "{requiredTableName: '" + tableName + "', recordId: '" + recordId + "'}", contentType: 'application/json; charset=utf-8', dataType: 'json', async: false, cache: false, timeout: 10000, success: function (response) { if (response.d != null) { sourceData = response.d; } }, error: function (xhr, status, error) { } });
Removed the single quotes from the parsed arguments:
data: “{requiredTableName: ‘” + tableName + “‘, recordId: ‘” + recordId + “‘}”,
Set the Source to the following:
source = { localData: sourceData, dataType: "json", dataFields: [ { name: 'FileId', type: 'number'}, { name: 'FileName', type: 'string'}, { name: 'EditLink', type: 'string'}, { name: 'DownloadLink', type: 'string'} ] };
Set the Local Data Source to use the returned JSON Object from the AJAX Call.
Changed from GET to POST (as the decoration originally used prohibited the using of POST.
So it all works, and I’m happy to have been able to solve the issue myself; however, can I ask, is this the best solution?
Cheers,
Kind Regards,
Ivan
-
AuthorPosts
Viewing 1 post (of 1 total)