0

hi i am trying to retrieve value of textbox using ajax on to another form without refresh but it is not working

Here is my code

<script>
        function sendsms() {
            var exam = new XMLHttpRequest();
            exam.onreadystatechange = function() {
                if (exam.readyState == 4) {
                    document.getElementById("RightPaneContainerDiv").innerHTML = exam.responseText;
                }

            }
            exam.open("GET", "freetrailsend.php?message=" + document.getElementById("cwc").value,"service=" + document.getElementById("dropdown").value, true);
            exam.send(null)
            return false;
        }
    </script>

where i am wrong in this code

Any help will be appreciated

anil kumar
  • 15
  • 1
  • 3
  • 9

1 Answers1

1

correct this line

exam.open("GET", "freetrailsend.php?message=" + document.getElementById("cwc").value,"service=" + document.getElementById("dropdown").value, true);

with this

exam.open("GET", "freetrailsend.php?message=" + document.getElementById("cwc").value + "&service=" + document.getElementById("dropdown").value, true);
Kartikeya Khosla
  • 18,743
  • 8
  • 43
  • 69
  • Don't forget to encode those URI components, so that special characters don't screw things up: http://stackoverflow.com/a/332888/759924 – Alex Sep 10 '14 at 10:10
  • @anilkumar... i think above answer will solve your problem if need more help then comment... – Kartikeya Khosla Sep 10 '14 at 10:21