Sriharsha
Sriharsha

Reputation: 160

Jquery Jtable create action giving error popup

I have created Jquery Jtable to do 3 operations- displaydata(list action), delete record and createaction.

Have implemented in asp.net web forms and its working fine for list action and delete action but create action is not working properly.

I'm able to add data in the backend and send json result and its giving 200 status in response with valid json data

It's hitting success in ajax call but its displaying error popup in Jtable without showing any error message.

Below is the function for create action.

createAction: function (postData) {
                var arr = postData.split('=');
                var userval = arr[1];
                return $.Deferred(function ($dfd) {
                    $.ajax({
                     contentType: "application/json; charset=utf-8",
                      url: '/MonitoringAdminService.asmx/CreateUserTemp',
                      type: 'POST',
                      dataType: 'json',
                        data: JSON.stringify({ username:userval}),
                        success: function (data) {
                            $dfd.resolve(data);
                        },
                        error: function (data) {
                            $dfd.reject();
                        }
                    });
                });
            }

Below is the error, but there is no error message in the popup as well as in developer console.status is 200

enter image description here

It would be great if you help to resolve the issue

Upvotes: 0

Views: 739

Answers (1)

misterP
misterP

Reputation: 185

Here is the code snippet inside jTable which is probably throwing the error window.

 //Show the error message if server returns error
 if (data.Result != 'OK') {
     self._showError(data.Message);
     return;
 }

if your server response does not have Result as 'OK' it will throw the dialog with whatever message the server has sent. If your Result is, for example 'ok' jTable will try and display the message, which may not exist, hence the blank dialog.

Upvotes: 1

Related Questions