NEED help
NEED help
Hello,
im getting stuck with one major problem:
I´am loading content via ajax to the client.
-
$("#alle_ma").click(function()
{
$.getJSON("rpc.php",{ type:"alle_ma"},alle_mitarbeiter);
function alle_mitarbeiter(ma_daten)
{
lenge = ma_daten['id'].length;
for(i=1;i<lenge;i++)
{
$("#alle_ma_ausgabe").append("<a class='ma_link' id='test"+ma_daten['id'][i]+"'>Name: "+ma_daten['name'][i]+" | MA-ID:"+ma_daten['id'][i]+"</a><br>");
}
}
});
And here is the rpc.php:
-
if($_GET['type'] == 'alle_ma')
{
$query = mysql_query("SELECT * FROM mitarbeiter");
while($result = mysql_fetch_assoc($query))
{
$name['name'][] = $result['name'];
$name['id'][] = $result['id'];
}
$json = json_encode($name);
echo $json;
}
With that script i get a list of all the wanted items.....
Every entry becomes a unique <a id="">
Now i want a click event for every entry....like:
I click on a entry, and then call a function to view only
details for that clicked-entry......
My main question:
a. i make an request getJSON to the server.
b. The server-script return json ($json = json_encode($name); echo $json;)
c. a callback-function becomes the json-data, and i had to loop through the items and pass them into a div or so....
Point c is my biggest problem....how to work with the data that i retrieved from the server ?
How to work with the json at client side ?
I DONT want the remote-server-script to output html, the remote site should ONLY produce data, and returning
them to the callback-function.....
I need a simple solution for that, so i can process learning jquery
Thanks
Julian