How to write here url considering el on the way to page 1-2-3 ...
function picdown(num) { [1,2,3,4,5,6].forEach(function(el) { if (el === num) { var msg = $('.pic' + el).serialize(); $.ajax({ type: 'POST', url:'/ajax/pic1.html' , data: msg, success: function(data) { $('.pic' + el).html(data); }, error: function(xhr, str){ alert('ошибка: ' + xhr.responseCode); } }); } }); } jQuery('.cp1').click(function() {picdown(1)}); jQuery('.cp2').click(function() {picdown(2)}); jQuery('.cp3').click(function() {picdown(3)}); jQuery('.cp4').click(function() {picdown(4)}); jQuery('.cp5').click(function() {picdown(5)}); jQuery('.cp6').click(function() {picdown(6)});
thank