javascript - How does this type of webservice throw slide images using JSON? -


{   "slider_images":      [       {"image":"http://www.jcwholesale.co.uk/slider_img/big/1_1433518577.jpg"},       {"image":"http://www.jcwholesale.co.uk/slider_img/big/1_1433519494.jpg"},       {"image":"http://www.jcwholesale.co.uk/slider_img/big/1_1433515458.jpg"},       {"image":"http://www.jcwholesale.co.uk/slider_img/big/1_1432292878.jpg"}     ] } 

using jquery:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

you can this:

$.ajax({         url: 'get_images',        method: 'post',        data: {}    }).done(function(data) {        //data should response object specified in question.        var container = $('#div_where_to_show images');         $.each(data.slider_images, function(_, image_obj){             container.append('<img>' + image_obj.image + '</img>');        })    }).fail(function(error) {          alert('failed');    }); 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -