Skip to main content

This code works:

$(this).load($('.pageloadlabel', this).attr('href'), {category: 1}); 

This code doesn't work:

var data = '{category: 1}'; $(this).load($('.pageloadlabel', this).attr('href'), data); 

The question is, how can I make it work? Thank you.

This code works:

$(this).load($('.pageloadlabel', this).attr('href'), {category: 1}); 

This code doesn't work:

var data = '{category: 1}'; $(this).load($('.pageloadlabel', this).attr('href'), data); 

The question is, how can I make it work? Thank you.

This code works:

$(this).load($('.pageloadlabel', this).attr('href'), {category: 1}); 

This code doesn't work:

var data = '{category: 1}'; $(this).load($('.pageloadlabel', this).attr('href'), data); 

The question is, how can I make it work?

Source Link
C. E.
  • 10.7k
  • 11
  • 57
  • 81

Can I use a variable to pass a json string?

This code works:

$(this).load($('.pageloadlabel', this).attr('href'), {category: 1}); 

This code doesn't work:

var data = '{category: 1}'; $(this).load($('.pageloadlabel', this).attr('href'), data); 

The question is, how can I make it work? Thank you.