Jump to content

how can i get song tracks to be auto inputted in javascript


divinedesigns1

Recommended Posts

ok I have this code, that I need to have change ones the album is selected in PHP. So pretty much this is the part I need to change

var tracks = {
	    "track1":["Fast Lane", "fast_lane"],
		"track2":["Breathe", "breathe"],
		"track3":["Stranglehold", "stranglehold"]
	};

im trying to get those tracks to be automatically be placed in javascript instead of having it being placed there manually, i know i need ajax to do this, can anyone give me a hint on exactly what i need to be doing?

Link to comment
Share on other sites

You can use PHP to write Javascript code the same way that it writes HTML. If you want to use ajax then you can send a request to PHP to get the track listing or whatever and build the array that way. In PHP you can build the same array structure and then use json_encode to just convert it to Javascript syntax.

Link to comment
Share on other sites

You can use PHP to write Javascript code the same way that it writes HTML. If you want to use ajax then you can send a request to PHP to get the track listing or whatever and build the array that way. In PHP you can build the same array structure and then use json_encode to just convert it to Javascript syntax.

thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...