Показать сообщение отдельно
  #13 (permalink)  
Старый 29.01.2017, 16:21
Профессор
Отправить личное сообщение для laimas Посмотреть профиль Найти все сообщения от laimas
 
Регистрация: 14.01.2015
Сообщений: 12,990

рони,
зачем плодить кучи форм, если они не отправляются естественным образом?

<html>
<head>
  <meta charset="utf-8">
  <script src="http://code.jquery.com/jquery-1.9.1.js"></script>

 <script>
$(function() {
    var inp = $('form').on('click', 'img', function() {
        var e = inp.slice(this.id * 2, this.id * 2 + 2);
        alert(e.eq(0).val() +'/'+ e.eq(1).val())
        //$.post("api.php",{type:'1',am:e.eq(0).val(),pm:e.eq(1).val()}, ...)
    }).find('input');
});
</script>
</head>
<body>
<form>
<input type="hidden" name="am" value="12">
<input type="hidden" name="pm" value="43">
<img src="" id="0" width="50" height="20"/>
<input type="hidden" name="am" value="92">
<input type="hidden" name="pm" value="11">
<img src="" id="1" width="50" height="20"/>
<input type="hidden" name="am" value="67">
<input type="hidden" name="pm" value="78">
<img src="" id="2" width="50" height="20"/>
</form>
</body>
</html>
Ответить с цитированием