php - Returning a correct JSON response -



php - Returning a correct JSON response -

i'm using laravel 4 project i'm working on. relies heavily on ajax lot of functionality.

in jquery utilize upload files (fileupload), have next success , fail function:

done: function (e, data) { // show success message }, fail: function (e, data) { // show fail message }

in controller, utilize next homecoming success or fail:

// success response homecoming response::json('success', 200) // fail response homecoming response::json('error', 400)

everything works fine functionality, success , fail messages show up, file uploads, perfect, except when function fails , returns fail response, in console see:

400 (bad request)

the error message still shows , good, i'm wondering if i'm handling correctly, don't reddish errors showing in console seems working correct.

any advice appreciated.

that how works. throwing html status code error - 'best practice' api.

the console showing error, because sees non-200 status code, , alerts you.

php jquery json laravel laravel-4

Comments

Popular posts from this blog

java Multi query from Mysql using netbeans -

c# - DotNetZip fails with "stream does not support seek operations" -

c++ - StartServiceCtrlDispatcher don't can access 1063 error -