Jump to content

[SOLVED] The correct way to pass this variable?


timmah1

Recommended Posts

I want to be able to pass a variable to javascript, so that it's available.

How is this possible?

 

I have this

url=url+"&sports="<?php echo $sport;?>

but that don't do anything at all.

 

Can anybody show me the correct way to show php in javascript?

 

Thanks in advance

function showTeam(str)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}

var url="getuser1.php"
url=url+"?q1="+str
url=url+"&sid1="+Math.random()
url=url+"&sports="<?php echo $sport;?>
xmlHttp.onreadystatechange=stateChanged1
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

 

I get no error, but no results either

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.