Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. JavaScript
  4. Jquery quering the db

Jquery quering the db

Scheduled Pinned Locked Moved JavaScript
csharpjavascriptdatabasetutorialquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    frostcox
    wrote on last edited by
    #1

    Hey everyone, I'm currently updating a project that is to be honest a bit dated, Data access layer is in c# and screen tier is in vb(dont't ask me why). Anyway for validation you always need to postback to validate data an that, I have started using jquery (which is cool by the way) for validation and I have it working for general data i.e invalid lenght, characters etc...., I'm just wondering how to get jquery to connect to the db to see if say the name in the textbox already exists?? Cheers

    V 1 Reply Last reply
    0
    • F frostcox

      Hey everyone, I'm currently updating a project that is to be honest a bit dated, Data access layer is in c# and screen tier is in vb(dont't ask me why). Anyway for validation you always need to postback to validate data an that, I have started using jquery (which is cool by the way) for validation and I have it working for general data i.e invalid lenght, characters etc...., I'm just wondering how to get jquery to connect to the db to see if say the name in the textbox already exists?? Cheers

      V Offline
      V Offline
      Vitaly Tomilov
      wrote on last edited by
      #2

      I don't get it why you need to do this in jQuery, if you already have C# in the back-end... You would, either way, need to do a post to implement such request, and implementing it in C# is the easiest thing to do. Invoking C# action from jQuery is very easy, there are plenty of examples about it in the internet.

      F 1 Reply Last reply
      0
      • V Vitaly Tomilov

        I don't get it why you need to do this in jQuery, if you already have C# in the back-end... You would, either way, need to do a post to implement such request, and implementing it in C# is the easiest thing to do. Invoking C# action from jQuery is very easy, there are plenty of examples about it in the internet.

        F Offline
        F Offline
        frostcox
        wrote on last edited by
        #3

        Was kinda thinking when the page firsts loads that I could some way store the values that were in the db and then if the user entered one of those values that jquery would present the user with a message to say this name already exists. I already have validation working for valid emails, lenght etc..

        B V 2 Replies Last reply
        0
        • F frostcox

          Was kinda thinking when the page firsts loads that I could some way store the values that were in the db and then if the user entered one of those values that jquery would present the user with a message to say this name already exists. I already have validation working for valid emails, lenght etc..

          B Offline
          B Offline
          BobJanova
          wrote on last edited by
          #4

          Preloading the complete list of valid values probably isn't the correct approach; for one thing, it could be quite large, and for another, do you really want users to be able to see all the values in this table? Doing an AJAX lookup at an appropriate time (send something like checkValue?typed=whattheusertyped to a simple server-side script), i.e. when they tab out of that field or pause typing for half a second, or something like that, seems like a better solution to me.

          1 Reply Last reply
          0
          • F frostcox

            Was kinda thinking when the page firsts loads that I could some way store the values that were in the db and then if the user entered one of those values that jquery would present the user with a message to say this name already exists. I already have validation working for valid emails, lenght etc..

            V Offline
            V Offline
            Vitaly Tomilov
            wrote on last edited by
            #5

            Validation against pre-fetched values is a heavier operation than server-side validation. You should just go for the latter as a much better standard ;) It will be one short post instead of sending a whole list of records into the browser.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups