I have the following two functions:
$(".content").click( function() {
var id = this.id;
$.get("InfoRetrieve", { theid:id }, addContent );
});
function addContent(data){
$("#0001").append(data);
}
I need to pass the 'id' variable from the first function to the addContent function, I don't quite get how this works. In the above example I am passing the "data" variable to the addContent function implicitly (it seems). Will I do something like this:
In the first function addContent -- becomes --> addContent(id)
In the second function
addContent(data) -- becomes --> addContent(data,id)
or something completely different?
Edit: I made modifications as per Denis' suggestion, however now it seems as if nothing happens - previously I had sone some hard coding so I was able to see my "data" being appended to the proper place:
$(".content").click( function() {
var id = this.id;
$.get("InfoRetrieve", { theid:id }, addContent {addContent(data, id)} );
});
function addContent(data, id){
alert(id);
$("#0001").append(data);
}
Another edit Firefox says:
missing ) after argument list
[Break on this error] $.get("InfoRetrieve", { theid:id ..., addContent {addContent(data, id)} );\n
.... but this doesn't seem to make sense since as far as I can see all the brackets match up with something else.