1

I have this code:

.load($(this).attr('href'), function (responseText, textStatus) {

Now, I want to modify that to loading a predefined variable instead of the href attribute. I tried this here but get an error:

params="option=1"; // example
var URL=ajax_url+"/?"+params;

.load($(this)URL, function (responseText, textStatus) {

What's the correct way?

1
  • Well,the href attribute is an URL used for the ajax call, you want a valid URL with a valid querystring, and it should work, assuming you do .load(URL, function() {... -> learn about variables Commented Sep 7, 2016 at 1:02

1 Answer 1

1

If your "URL" is valid, then it should just be:

.load(URL, function (responseText, textStatus) {

}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.