A request to a php file with no data sent

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cleary1981
    New Member
    • Jun 2008
    • 178

    A request to a php file with no data sent

    I want to get data from an external php file. This is how I would normally do it but this time I am not sending any data in the request. How do I achieve this when no data is being sent in the request?

    Code:
    <script type="text/javascript" src="text-utils.js"> </script>
    <script type="text/javascript" src="request.js"> </script>
    <script type = "text/javascript">
    window.onload = function() {
    	getProjects();
    }
    function getProjects() {
    	var url = "needmodule.php";
    	url = url + "&dummy=" + new Date().getTime();
    	request.open("GET", url, true);
    	request.onreadystatechange = updateProjects;
    	request.send(null);
    }
    function updateProjects() {
    	if (request.readyState == 4) {
    		var returned = request.responseText;
    		alert(returned);
    }
    </script>
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    But you do send data. Although it's GET data...
    Furthermore (this might be a writing mistake) shouldn't there be a "?" instead of an "&" in line 9?

    Comment

    • Ferris
      New Member
      • Oct 2007
      • 101

      #3
      yes,Dormilich is right , and furthermore, you missed a } in line 17. It should be
      [HTML]alert(returned) ; }[/HTML]

      Comment

      Working...