www.webdeveloper.com
Results 1 to 3 of 3

Thread: How ajax deal with exceptions ?

  1. #1
    Join Date
    Apr 2005
    Posts
    24

    How ajax deal with exceptions ?

    Hi,

    let say we have an ajax that post some data to the server-side, for example some data to be inserted in a table in the database, I think there are two kind of exceptions that could occur :

    1) problem inserting data in the database.
    2)ajax communication with server side problem.

    so each one of the two exceptions above will send a json message back to the ajax so the user will know that :
    1) submit was successful.
    2)submit was not successful (problem inserting in the database)
    3) submit was not successful because of ajax communication problem.


    For me this is the theory, can you please give me an example on how to implement the ajax to deal with the 3 above json messages ?

    Thanks, your help is appreciated.

  2. #2
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    2,292
    Ajax does not insert anything, it is merely the medium which carries the data. The use of AJAX is to replace the older form submit so that you can carry out seamless actions in background.

    Your receiving script which would live on the server would responsible for returning any control codes to indicate success or not.

    Any problems with inserting data would be down to how good you are at programming for that eventuality.
    Yes, I know I'm about as subtle as being hit by a bus..(\\.\ Aug08)
    Yep... I say it like I see it, even if it is like a baseball bat in the nutz... (\\.\ Aug08)
    I want to leave this world the same way I came into it, Screaming, Incontinent & No memory!
    I laughed that hard I burst my colostomy bag... (\\.\ May03)
    Life for some is like a car accident... Mine is like a motorway pile up...

    Problems with Vista? :: Getting Cryptic wid it. :: The 'C' word! :: Whois?

  3. #3
    Join Date
    Feb 2003
    Location
    Michigan, USA
    Posts
    5,773

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles