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. I don't update DB with javascript

I don't update DB with javascript

Scheduled Pinned Locked Moved Web Development
javascriptdatabasedebugginghelpquestion
11 Posts 4 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.
  • T tranglt

    I have some code: -------Javascript ------------ ... function SavePosition(source) { // Call AJAX request to save //var url = "Home.aspx?order=" + getPositionOrder(); url = "Home.aspx?order=0 s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 s11 s12" var objXmlHttp = createXMLHTTP(); objXmlHttp.open("GET", url, true); if(objXmlHttp == null) { alert("Browser does not support HTTP request!"); return; } ShowWarning(source, waitingHTML); objXmlHttp.onreadystatechange = function() { if (objXmlHttp.readyState == 4) { if(objXmlHttp.status == 200) { setTimeout("complete()", 2000); } else { alert("Error while trying to save."); } } } objXmlHttp.send(null); } When I execute the function and debug it, I see that. sometime, it executes very well, my DB is updated that mean home.aspx loaded. sometime it do nothing (because home.aspx does not load) although run step over objXmlHttp.open("GET", url, true); :doh:

    G Offline
    G Offline
    Guffa
    wrote on last edited by
    #2

    The invalid URL that you are using might be part of the problem. An URL may not contain spaces, you have to encode the URL correctly. Try: url = "Home.aspx?order=0%20s1%20s2%20s3%20s4%20s5%20s6%20s7%20s8%20s9%20s10%20s11%20s12"

    --- single minded; short sighted; long gone;

    T 1 Reply Last reply
    0
    • G Guffa

      The invalid URL that you are using might be part of the problem. An URL may not contain spaces, you have to encode the URL correctly. Try: url = "Home.aspx?order=0%20s1%20s2%20s3%20s4%20s5%20s6%20s7%20s8%20s9%20s10%20s11%20s12"

      --- single minded; short sighted; long gone;

      T Offline
      T Offline
      tranglt
      wrote on last edited by
      #3

      Ok, I try it again, thanks you so much. :laugh:

      T 1 Reply Last reply
      0
      • T tranglt

        Ok, I try it again, thanks you so much. :laugh:

        T Offline
        T Offline
        tranglt
        wrote on last edited by
        #4

        I tried it, but ... it don't run. My problem: I have two textarea (object1 and object2). if { I have swap object1 and object1 (dag object1 to object 2) click save --> database was updated. } but after, I want to go back { I drag object come back. click save --> database was not saved. } --> The BIG PROBLEM! HELP ME!!!!!:^)

        G V 2 Replies Last reply
        0
        • T tranglt

          I have some code: -------Javascript ------------ ... function SavePosition(source) { // Call AJAX request to save //var url = "Home.aspx?order=" + getPositionOrder(); url = "Home.aspx?order=0 s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 s11 s12" var objXmlHttp = createXMLHTTP(); objXmlHttp.open("GET", url, true); if(objXmlHttp == null) { alert("Browser does not support HTTP request!"); return; } ShowWarning(source, waitingHTML); objXmlHttp.onreadystatechange = function() { if (objXmlHttp.readyState == 4) { if(objXmlHttp.status == 200) { setTimeout("complete()", 2000); } else { alert("Error while trying to save."); } } } objXmlHttp.send(null); } When I execute the function and debug it, I see that. sometime, it executes very well, my DB is updated that mean home.aspx loaded. sometime it do nothing (because home.aspx does not load) although run step over objXmlHttp.open("GET", url, true); :doh:

          T Offline
          T Offline
          tranglt
          wrote on last edited by
          #5

          I tried it, but ... it don't run. My problem: I have two textarea (object1 and object2). if { I have swap object1 and object1 (dag object1 to object 2) click save --> database was updated. } but after, I want to go back { I drag object come back. click save --> database was not saved. } --> The BIG PROBLEM! HELP ME!!!!!

          H 1 Reply Last reply
          0
          • T tranglt

            I tried it, but ... it don't run. My problem: I have two textarea (object1 and object2). if { I have swap object1 and object1 (dag object1 to object 2) click save --> database was updated. } but after, I want to go back { I drag object come back. click save --> database was not saved. } --> The BIG PROBLEM! HELP ME!!!!!:^)

            G Offline
            G Offline
            Guffa
            wrote on last edited by
            #6

            I handly understand anything of what you are writing. Could you try to explain it in complete sentences?

            --- single minded; short sighted; long gone;

            T 1 Reply Last reply
            0
            • G Guffa

              I handly understand anything of what you are writing. Could you try to explain it in complete sentences?

              --- single minded; short sighted; long gone;

              T Offline
              T Offline
              tranglt
              wrote on last edited by
              #7

              Thanks you so much. I have a problem below. I use javascript in my project to drag and drop some objects that exchange position. when I log in and do the function (drag and drop) after save the position to my DB ==> OK. But i drag and drop back and save ==> it is not save to DB ==> BROBLEM???? i used dojo library.

              1 Reply Last reply
              0
              • T tranglt

                I tried it, but ... it don't run. My problem: I have two textarea (object1 and object2). if { I have swap object1 and object1 (dag object1 to object 2) click save --> database was updated. } but after, I want to go back { I drag object come back. click save --> database was not saved. } --> The BIG PROBLEM! HELP ME!!!!!

                H Offline
                H Offline
                HarryIsp2007
                wrote on last edited by
                #8

                you can try with !ispostback; If can't please reply;:):):):)

                V 1 Reply Last reply
                0
                • T tranglt

                  I tried it, but ... it don't run. My problem: I have two textarea (object1 and object2). if { I have swap object1 and object1 (dag object1 to object 2) click save --> database was updated. } but after, I want to go back { I drag object come back. click save --> database was not saved. } --> The BIG PROBLEM! HELP ME!!!!!:^)

                  V Offline
                  V Offline
                  Vasudevan Deepak Kumar
                  wrote on last edited by
                  #9

                  Spaces in URL ought to be URLEncoded before being transmitted.

                  tranglt wrote:

                  --> The BIG PROBLEM! HELP ME!!!!!

                  Please avoid such quotes in discussion forums.

                  Vasudevan Deepak Kumar Personal Homepage Tech Gossips

                  1 Reply Last reply
                  0
                  • H HarryIsp2007

                    you can try with !ispostback; If can't please reply;:):):):)

                    V Offline
                    V Offline
                    Vasudevan Deepak Kumar
                    wrote on last edited by
                    #10

                    :)

                    Vasudevan Deepak Kumar Personal Homepage Tech Gossips

                    H 1 Reply Last reply
                    0
                    • V Vasudevan Deepak Kumar

                      :)

                      Vasudevan Deepak Kumar Personal Homepage Tech Gossips

                      H Offline
                      H Offline
                      HarryIsp2007
                      wrote on last edited by
                      #11

                      English pleaase. Im vietnamese but i use english, why u can't?

                      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