JQuery $ .post () and IE7

In IE7, I do not get a response from my POST:

function updateItem(item) {
  $.post("updater.php",{key:item.id, value:item.value},function(response) {
    $('#response').html(response);
  });
}

<div id="response"></div>
<select id="PRIMARY_KEY" onchange="updateItem(this)">
  <option>1</option>
  <option>2</option>
</select>

<?php
  echo 'UPDATED KEY: ' . $_POST['key'] . ' TO: ' . $_POST['value'];
?>

It works with all my other browsers. Why is this?

Edit: At first I tried to answer this question .

+3
source share
3 answers

Try the following: (2 modifications: value's ... value and <option value="1">1</option>)

<script>
    function updateItem(item) {
  $.post("updater.php",{key:item.id, value:item.options[item.selectedIndex].value}, function(response) {
    $('#response').html(response);   });

}
</script>
<div id="response"></div>
<select id="primary_key" onchange="updateItem(this)">
  <option value="1">1</option>
  <option value="2">2</option>
</select>

I used jsfiddle, IE7 and debugBar to find them. http://jsfiddle.net/d3xk8/

+3
source

Error setting innerHTMLthrough jquery.

Use document.getElementById("#response").innerHTML = response;

+1
source

, , , , . , , , .

0

Source: https://habr.com/ru/post/1774096/


All Articles