0

This is my Ajax call

<script>
$.ajax({
        url:"http://localhost:3000/house/get-all",
        type: "GET",
        dataType: 'json',
        data,    
        crossDomain: "true",      

      }
      });
</script>

This is my html code:

<div id="houses">
This is place to put content. You can put slider, short description about your website and place some links for navigation.
</p>
</div>

ERROR:

Uncaught ReferenceError: data is not defined

2
  • @brk i dont understand what you say.. Commented Jun 17, 2017 at 13:44
  • 2
    you have dataType: 'json', data,, where are you defining data? Commented Jun 17, 2017 at 13:44

1 Answer 1

1

You don't need the data, if you are not passing any data in your ajax options:

$.ajax({
    url:"http://localhost:3000/house/get-all",
    type: "GET",
    dataType: 'json',
    // data, -- remove this or pass something here
    // ...
});
Sign up to request clarification or add additional context in comments.

1 Comment

Works fine! Thanks!

Your Answer

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