0

Not sure why I am getting this error:

Uncaught RangeError: Maximum call stack size exceeded

Using the following:

$(document).on("click", "#requestData", function(){
  var selectcriteria = {
    city: document.getElementById('city'),
    pod: document.getElementById('pod'),
    status: document.getElementById('status'),
    // few more
  }

  $.post('functions/requestData.php', {selectcriteria:selectcriteria}, function(data) {
    console.log(data);
  });
});

I have used this same method for a number of sites. The only difference is the other sites used more JQuery to grab the values. For example:

$('#requestData').on("click", function(){
  var selectcriteria = {
    city: $('#city').val(),
    // and so on
  }
});

That's really the only difference.

What can I do to fix this?

Lelio Faieta
  • 6,457
  • 7
  • 40
  • 74
John Beasley
  • 2,577
  • 9
  • 43
  • 89
  • 2
    You need to provide the `.value` to the properties in the object you send in `$.post()`, not the entire Element object. `city: document.getElementById('city').value,` – Rory McCrossan Jun 03 '21 at 16:05
  • @RoryMcCrossan - Looks like the question was closed, but your suggestion solved my problem. Thanks again. – John Beasley Jun 03 '21 at 21:29

0 Answers0