<div id="container">
This will change to the raw AJAX response
</div>
<div id="formatted">
This will change to the formatted AJAX response
</div>
CSS
html, body {
background:#ddd;
padding:10px;
}
div {
margin:10px; padding:20px;
background:white;
}
JavaScript
jQuery(function ($) {
var _container = $('#container'),
_formatted = $('#formatted'),
_ajax = $.ajax({
url : '/echo/html/',
type : 'POST',
data : {
html : '<p>hello <span>world!</span></p>',
delay : 3
},
});
_ajax.success(function (m) {
// pagkatapos ng isang AJAX request na nag-e-expect ka ng HTML response,
// puwede mong i-display agad yung HTML
_container.html(m);
// ... or puwede mo i-manipulate muna yun like so:
var _html = $(m);
_html.find('span').text('Kuya Nico!');
_formatted.html(_html);
});
});
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.