JsFiddle / echo / html not working with jQuery

http://jsfiddle.net/YcK5X/ I wonder why this AJAX request does not return anything.

$.ajax({
    type: 'POST',
    url: '/echo/html',
    data: 'Echo!',
    success: function(data) {
        $('#ajax').html(data);
    },
    dataType: 'text/html'
});
+5
source share
1 answer

The data you want echo: ed to receive must be specified in the POST parameter with the name html:

$.ajax({
  type: 'POST',
  url: '/echo/html/',
  data: {
    'html': 'Echo!'
  },
  success: function(data) {
    $('#ajax').html(data);
  },
  dataType: 'text/html'
});
+14
source

All Articles