Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function() {
- $(document).on("click", ".call-ajax", function () {
- var queryId = $(this).attr('data-product-id');
- $.ajax({
- url: '/product/product-ajax',
- type: 'POST',
- dataType: 'json',
- data: {productId: queryId},
- success: function(data) {
- JSON.stringify(data);
- console.log("fired");
- $.each(data.pictures, function() {
- $.each(this, function(k, v) {
- $('.carousel-inner').html('<div class="item"><img src="/public/uploads/images/'+ v +'"><div class="carousel-caption"></div> </div>');
- $('<li>', { 'data-target': '#carousel-example-generic', 'data-slide-to': k });
- });
- });
- $('.modal-title').text(data.ProductName);
- $('.item').first().addClass('active');
- $('.carousel-indicators > li').first().addClass('active');
- $('#carousel-example-generic').carousel();
- }
- })
- .fail(function() {
- console.log("error");
- })
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement