Jump to content

[SOLVED] Get data


balkan7

Recommended Posts

please help me data from clicked link.

 

radio_panel.php

<?php
echo "<script type='text/javascript' src='radio.js'></script>";

openside("Radio");

echo "<table width='100%' cellpading='0' cellspacing='0' class='center'>\n<tr>\n";
echo "<td class='tbl1' witdh='50%'>Domasni</td>";
echo "<td class='tbl1' witdh='50%'><a href=\"javascript: page('stranski')\">Stranski</td>\n</tr>\n<tr>";

if (isset($_GET['page']) == "stranski"){
echo "<td class='tbl'><div id='radio'>Stranski radio stanici</div></td>";
} else {
echo "<td class='tbl'>Domasni radio stanici</td>";	
}

echo "<tr>\n</table>\n";
closeside();
?>

 

and radio.js

function getHTTPObject() {
var xmlhttp;

if(window.XMLHttpRequest){
	xmlhttp = new XMLHttpRequest();
}
else if (window.ActiveXObject){
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	if (!xmlhttp){
		xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
	}
}
return xmlhttp;	
}
var http = getHTTPObject(); // We create the HTTP Object
/*  */

function page(radio) {

  http.abort();
  http.open("GET", "radio_panel.php?page=" + radio, true);
  http.onreadystatechange = function() {
  	if(http.readyState == 1) {
  		// Loading indicator
  	 document.getElementById('radio').innerHTML = '<img src=\"images/loading.gif\">';
  	}
    if(http.readyState == 4) {
      document.getElementById('radio').innerHTML = http.responseText;
      
      http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http.setRequestHeader("Content-length", param.length);
      http.setRequestHeader("Connection", "close");
    }
  }
  http.send(null);
}

 

Link to comment
Share on other sites

It looks like you're using POST headers

      http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http.setRequestHeader("Content-length", param.length);
      http.setRequestHeader("Connection", "close");

with a GET request.  What happens if you remove those lines?

Link to comment
Share on other sites

i change js code but nothing happens  ???

 

radio.js

var XMLHttpRequestObject = false;

      if (window.XMLHttpRequest) {
        XMLHttpRequestObject = new XMLHttpRequest();
      } else if (window.ActiveXObject) {
        XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
      }

      function radio(page, DivID)
      {
        if(XMLHttpRequestObject) {
          var obj = document.getElementById(divID);
          XMLHttpRequestObject.open("GET", "radio_panel.php?page=" + page, true);

          XMLHttpRequestObject.onreadystatechange = function()
          {
          	if(XMLHttpRequestObject.readyState == 1) {
             // Loading indicator
             obj.innerHTML = '<img src=\"images/loading.gif\">';
             }
            if (XMLHttpRequestObject.readyState == 4 &&
              XMLHttpRequestObject.status == 200) {
                obj.innerHTML = XMLHttpRequestObject.responseText;
            }
          }

          XMLHttpRequestObject.send(null);
        }
      }

 

and html

<a href=\"javascript:radio('strasnki', 'show');\">Stranski</a>
<div id='show'>show here!!!</div>

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.