0 Replies Latest reply on Jul 24, 2012 10:39 AM by tomtomtom

    How to use AJAX to update a database?


      Hello all


      I have a basic AJAX question. Please note that I have no knowledge in AJAX but a little in CF, so please explain very detailed or even write the necessary code for me - thank you.


      I built a database containing 8k images (images are not in the database but this isn't the issue). each image has a couple of attributes. Among them one which I call quality and which can have integer values from 1 to 9. By default I set all values to 5.

      I made a query which selects one image at the time (this is actually not of interest) and display all its attributes on a webpage. I would like now that the quality attribute can be changed without firing a form to another page but by just moving a slider (cfslider) to the value the visitor of this page likes.


      For the moment I wrote the following:


      <cfquery name="myQuery" dbtype="query">
      SELECT * FROM myTable


           name = "myQuality"
           clickToChange = "false"
           format = "html"
           increment = "1"
           max = "9"
           min = "1"
           tip = "true"
           value = "#myQuery.pic_quality#"
           vertical = "false"
           width = "100">


      My questions:
      Do I need to write a cfc or so, which can be called to update the field "pic_quality" in "myTable"
      If yes, how? Where to implement AJAX? Puuuuhuhhhh, I have no idea!


      Thank you so much for input!