1

I am trying to check if a particular record already exists in database before adding a new record.

ajax Call

"ajaxRecordExistsCall": {
                    "url": "Controller?action=GET_LIST",
                    "extraDataDynamic": ['#id'],
                    "alertText": "* Record already exists",
                    "alertTextOk": "good to go!",
                    "alertTextLoad": "* Validating, please wait"
                }

The resulting HTTP request header looks like this

http://localhost:8080/xyz/Controller?action=GET_LIST&fieldId=Edit-Id&fieldValue=someValue&_=1430828274372

where as I want a HTTP request header to like this, in order to make it work.

http://localhost:8080/xyz/Controller?action=GET_LIST&id=someValue

why it is appending fieldId & fieldValue to HTTP request header?

From Controller,corresponding response is returned as JSON string.

jsonArray = "{\"Result\":\"OK\",\"Records\":" + jsonArray + "}";

Problem: jquery continously display following"alertTextLoad": "* Validating, please wait"

where as, it should display "alertText": "* Record already exists", if the record exists.

what kind of response ajaxCall requires in order to display proper error alert?

Where am I doing wrong ?

1 Answer 1

1

The response is Boolean true or false
["Edit-Id",false] will display the alertText
["Edit-Id",true] will display the alertTextOK

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.