title: How to fix the jquery with ajax code localhost says object object error
body: <p>When i call this jquery function with ajax getting <a href="https://i.stack.imgur.com/jafjk.png" rel="nofollow noreferrer">this error</a></p>
  
  <blockquote>
    <p>[object Object]</p>
  </blockquote>
  
  <pre><code>$('a#room_no').click(function() {
    var roomNumber = $(this).text();
    alert(roomNumber);
    var href = $(".room_check_out_form").attr('href');
    $.ajax({
      type: "POST",
      url: href,
      data: {
        roomNumber: roomNumber
      },
      dataType: "JSON",
      success: function(data) {
        console.log(data);
        alert(data.roomNumber)
      },
      error: function(err) {
        alert(err);
      }
    });
  });
  </code></pre>