getJSON on load
getJSON on load
by Ford Heacock
HTML
<select multiple id="div2">
</select>
<div id="div1">
</div>
JavaScript
var code = encodeURI(["Hello World", "Ford", "Billy", "Bobby"]);
function getSuccessOutput() {
$.ajax({
url:'/echo/js/?js=' + code,
complete: function (response) {
$('#div2').html("<option>" + response.responseText + "</option>");
},
error: function () {
$('#output').html('Bummer: there was an error!');
},
});
return false;
}
getSuccessOutput();