kaleazy
kaleazy

Reputation: 6242

How to Transfer Element Id's into Hyperlink of JSON Get Request?

I'm trying to insert two Element Id's right in the middle of a hyperlink contained within a JSON (JSON-P) get request using jQuery. Any suggestions?

function doFunction(id1,id2) {
    $.getJSON("http://google.com/[id1]/[id2]?callback=?");
}

Upvotes: 0

Views: 131

Answers (2)

bondythegreat
bondythegreat

Reputation: 1409

 $.getJSON("http://google.com/"+id1+"/"+id2+"?callback=?");

Upvotes: 1

David Hedlund
David Hedlund

Reputation: 129812

Not sure I follow; is this what you're looking for?

function doFunction(id1,id2) {
    $.getJSON("http://google.com/" + id1 + "/" + id2 + "?callback=?");
}

Upvotes: 2

Related Questions