Jump to content

ajax's help


kdhearon

Recommended Posts

since i suck at explaining this here is a image to show what i am talking about

 

dynamic.jpg

 

Also would like it like this

dynamic2.jpg

 

The site is www.the-leg.net/xcg

 

The ajax.php is

 

<?php

header("Content-Type: text/javascript");

include("_mysql.php");

include("_settings.php");

include("_functions.php");

$get = safe_query("SELECT * FROM ".PREFIX."squads");

?>

squads = new Array();

<?php

$i=1;

while($ds = mysql_fetch_array($get)){

echo "squads[".$i."] = '".$ds['name']."';\n";

$i++;

}

?>

cur = 1;

var max = <?=mysql_num_rows($get);?>;

var http_request = false;

function ajax_request(url) {

if(url<=0) url = max;

if(url>max) url = 1;

cur = url;

url = 'ajax_squads.php?s='+url;

//alert(cur);

http_request = false;

 

if (window.XMLHttpRequest) { // Mozilla, Safari,...

http_request = new XMLHttpRequest();

if (http_request.overrideMimeType) {

http_request.overrideMimeType('text/xml');

// zu dieser Zeile siehe weiter unten

}

} else if (window.ActiveXObject) { // IE

try {

http_request = new ActiveXObject("Msxml2.XMLHTTP");

} catch (e) {

try {

http_request = new ActiveXObject("Microsoft.XMLHTTP");

} catch (e) {}

}

}

 

if (!http_request) {

//$(div).innerHTML = 'Ende  Kann keine XMLHTTP-Instanz erzeugen';

return false;

}

http_request.onreadystatechange = function (){

if (http_request.readyState == 4) {

if (http_request.status == 200) {

//$(div).innerHTML = http_request.responseText;

// $('squad_name').innerHTML = squads[cur];

//alert(http_request.responseText);

} else {

//$(div).innerHTML = 'Bei dem Request ist ein Problem aufgetreten.';

}

}

};

http_request.open('GET', url, true);

http_request.send(null);

 

}

 

 

 

It is just not working right. I cant figure it out. Please help!

 

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.