Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jsFiddle /echo/html not working with jQuery

http://jsfiddle.net/YcK5X/ I'm wondering why this AJAX request doesn't return anything.

$.ajax({
    type: 'POST',
    url: '/echo/html',
    data: 'Echo!',
    success: function(data) {
        $('#ajax').html(data);
    },
    dataType: 'text/html'
});
like image 292
nyuszika7h Avatar asked Dec 24 '10 21:12

nyuszika7h


1 Answers

The data you want echo:ed must be supplied in a POST parameter named html:

$.ajax({
  type: 'POST',
  url: '/echo/html/',
  data: {
    'html': 'Echo!'
  },
  success: function(data) {
    $('#ajax').html(data);
  },
  dataType: 'text/html'
});
like image 130
Gustav Barkefors Avatar answered Oct 16 '22 13:10

Gustav Barkefors