Format the jkuery .load function correctly when using a response first

advertisements

I can't figure out how to correctly format the .load function with what I'm doing.

Everything works fine if I provide the URL but cant get it working without errors when using the response first.

Here is what works:

$("#postholder #" +response.postid).load("viewbuild.php?id=22 #" +response.postid, function() {

But instead of giving the URL directly, I want to use a URL that I return.

So ideally something like this:

$("#postholder #" +response.postid).load(response.pageurl "#" +response.postid, function() {

I have also tried this:

$("#postholder #" +response.postid).load(response.pageurl + "#" +response.postid, function() {

Which works in a sense, but doesn't load the specified div. Instead simply loads the whole page.

But that doesn't work of course. Can anyone just give me the way I should be doing this?


In the working example there are a space between the url and the hashtag(#)/id. Try:

$("#postholder #" +response.postid).load(response.pageurl + " #" +response.postid, function() {