SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: Jquery loop

  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2010
    Location
    Bangladesh
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Jquery loop

    Hello Everybody,

    Hope all r fine.

    In many application we see If anyone want to create for example category of a product, I want to make it more desktop like using jQuery Ajax.

    Here is my idea
    A form with a text field for category title. and a button will be there "create and add another". when user clicks this button a category is successfully adding to DB using $.post but after that how I can make the form appear again as many times user wants?

    regards,
    Rashed

  2. #2
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,036
    Mentioned
    152 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by rashidul View Post
    A form with a text field for category title. and a button will be there "create and add another". when user clicks this button a category is successfully adding to DB using $.post but after that how I can make the form appear again as many times user wants?
    Instead of that, why don't you just clear all the form fields upon successful submission? Way easier IMO.
    Rémon - Hosting Advisor

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  3. #3
    SitePoint Enthusiast
    Join Date
    Aug 2010
    Location
    Bangladesh
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks so how can I make the loop?

  4. #4
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,036
    Mentioned
    152 Post(s)
    Tagged
    2 Thread(s)
    In pseudo code:

    Code:
    if (user submits form) {
      post values using AJAX with the callback function {
        if (values are ok) {
          show message "successfully saved"
          empty fields
        } else {
          show message "failed to save. The following errors occurred: ..."
        }
      }
    }
    after the submission was successful and the values were ok the user is presented with the same form but empty and can start anew
    Rémon - Hosting Advisor

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy


Tags for this Thread

Bookmarks

Posting Permissions

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