开发者

jsFiddle /echo/html not working with jQuery

开发者 https://www.devze.com 2023-01-31 22:36 出处:网络
http://jsfiddle.net/YcK5X/ I\'m wondering why this AJAX request doesn\'t return anything. $.ajax({ type: \'POST\',

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'
});


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'
});
0

精彩评论

暂无评论...
验证码 换一张
取 消