Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. $(document).ready(function() {
  2. $(document).on("click", ".call-ajax", function () {
  3. var queryId = $(this).attr('data-product-id');
  4. $.ajax({
  5. url: '/product/product-ajax',
  6. type: 'POST',
  7. dataType: 'json',
  8. data: {productId: queryId},
  9. success: function(data) {
  10. JSON.stringify(data);
  11. console.log("fired");
  12. $.each(data.pictures, function() {
  13. $.each(this, function(k, v) {
  14. $('.carousel-inner').html('<div class="item"><img src="/public/uploads/images/'+ v +'"><div class="carousel-caption"></div> </div>');
  15. $('.carousel-indicators').html('<li data-target="#carousel-example-generic" data-slide-to="'+ k +'"></li>');
  16. });
  17. });
  18. $('.modal-title').text(data.ProductName);
  19. $('.item').first().addClass('active');
  20. $('.carousel-indicators > li').first().addClass('active');
  21. $('#carousel-example-generic').carousel();
  22. }
  23. })
  24. .fail(function() {
  25. console.log("error");
  26. })
  27. });
  28. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement