Fernando
Fernando

Reputation: 75

Error in processing ajax jquery

is giving an error that can not capture with firebug, I wonder what's wrong with this code?

var obj = {}; obj.registry= $("#ctl00_ContentPlaceHolder1_TextBox3").val();
    $.ajax({
        type: "POST",
        url: "Page.aspx/PatientCheck",
        data: JSON.stringify(obj.toString()),
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function(msg)
        {
            isErrror= true;
        },
        error: function()
        {

        }
    });

this code is to validate that there are already a patient with the same code, so the validator.

Upvotes: 1

Views: 122

Answers (2)

jk.
jk.

Reputation: 14435

Change this line:

data: JSON.stringify(obj.toString()),

To this:

data: JSON.stringify(obj),

Upvotes: 1

Ilia Choly
Ilia Choly

Reputation: 18557

either

data: {str: JSON.stringify(obj)}

or

data: obj

Upvotes: 1

Related Questions