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. Classic ASP and 'AJAX', and a database update

Classic ASP and 'AJAX', and a database update

Scheduled Pinned Locked Moved Web Development
databasequestioncsharpjavascripttools
1 Posts 1 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.
  • A Offline
    A Offline
    AaronM_NZ
    wrote on last edited by
    #1

    I have an old classic ASP app that I am trying to do some AJAX on (the real way, not Microsoft .Net way). I have a couple of DIVs that are alternated from hidden to visible (depending on if its an UPDATE or READ), which are controlled by a href='#' and an ONCLICK call to some javascript to do the hiding/displaying. My question is, whats the best approach to trigger a database update back when the hyperlink is clicked for the update? Should I be changing the hyperlink to a form button, or have a full form hidden and displayed, rather than just a hyperlink? Just looking for an approach, dont need actual code. Here is a brief sample of the code I am working with. Note its in a Do..Until loop and returns a few hundred entries back from the database. showHide simply swaps the display: setting, and changeHTML changes the innerHTML of the control passed to it.

    <script type="text/javascript">
    function showHide<% Response.Write unqID %>()
    {
    unqID = '<%Response.write unqID %>';
    showHide('Comment' + unqID);
    showHide('ExpandComment' + unqID);
    if(document.getElementById('Edit' + unqID).innerHTML == 'Update')
    {changeHTML('Edit' + unqID,'Edit...');}
    else
    {changeHTML('Edit' + unqID,'Update');}

     }
    

    </script>

    <a href="#" id="Edit<%Response.write curATMID %>" onclick="showHide<%Response.write unqID %>(); return(false);" class="Comment">Edit...</a>

    <div id="<%Response.write "Comment" & unqID %>">
    <% Response.Write "<b>" & Trim(db("Comments")) & "</b>" %>
    </div>

    <div id="Expand<%Response.write "Comment" & curATMID %>" style="display:none">
    <textarea id='cmtUpdate<%Response.write "Comment" & curATMID %>' type='text'
    style='width:100%; height=60px;'
    rows='4' cols='100'>
    <%Response.Write Trim(db("Comments")) %> </textarea>
    </div>

    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