jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Alternate to $ajax post method
Tagged: Alternate code to Jquery ajax
This topic contains 5 replies, has 2 voices, and was last updated by chengamkathiravan 11 years, 3 months ago.
-
Author
-
Hi,
We need alternate jqwidgets code to below ajax code because this(Ajax post) code is not working properly in cross browser.
Also we are accessing java json service and to bind the data with grid.
ajax post method:-
$.ajax({
headers: { “Content-Type”: “application/json”, “AuthenticationToken”: “3C9DA1B8-FA69-4195-B1A1-B6CF43CD3ACF” },
data: “<Employee><GroupId>value</GroupId></Employee>”,
type: “POST”,
async: false,
cache: false,
url: ‘https://ip/Tpx/Employee/testurl/json/v1’,success: function (data) {
alert(‘Success’);
},
error: function (json, textStatus, errorThrown) {
alert(“jqXHR= ” + json.statusText + “, textStatus= ” + textStatus + “, errorThrown= ” + errorThrown)
}Points to your notice:-
1) We need to post data (data:xxx) to url.
2) We need to pass authentication token, content type in header.
3) This method is POST.Please give alternate code using “dataAdapter” or any other common method to be worked in cross browser.
Best Regards
BalaHi,
One more point is already our java service is CORS enabled. Also this given code works fine in firefox browser. But in IE and Chrome it is not working.We need stable code to be worked across cross browser.
Best Regards
Bala.Hi Bala,
Please, read: http://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-datasources.htm. With jQWidgets, data binding goes through jqxDataAdapter so you’d better look at: http://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdataadapter/jquery-data-adapter.htm.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Hi Peter,
Thanks for your reply.
I gone through the given url.
Meanwhile We are explaining below our requirement step by step.Please go through the steps deeply.
1) We need to access JAVA json service.
2) We need to POST data to that json service.
3) We need to send authentication token to that json service as Header.
4) Our output from service is json.For this we try to use jquery ajax post method. But it is not working in cross browsers.
Please answer to our below questions.
1) Is it possible to POST data to java service using “jqxDataAdapter” like jquery ajax method?
2) Is it possible to send authentication token to java service as HEADER using “jqxDataAdapter” like jquery ajax method?If your answer is yes, then please provide code/link/sample to achieve the same.
Please answer to our questions at earliest.
Best Regards
Bala.Hi Bala,
1. POST is not a problem. As you probably saw in the help topics, you should set the source object’s type to POST i.e the same as you do with jQuery Ajax.
2. headers member is not available option.Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Hi Peter,
Due to problem with $ajax post method, we tried aspx webmethods and bind the jqxgrid.
We will proceed with webmethod for now.
We need any help in this regard, then we will intimate to you.
Best Regards
Bala. -
AuthorPosts
You must be logged in to reply to this topic.