Подскажите где ошибка в коде
<script type="text/javascript">
var nomer=<?=$id?>;
$(function(){
$('#plus'+nomer).submit(function(e){
e.preventDefault();
var data = $(this).serialize();
$.ajax({
type: "POST",
url: "plus.php",
data: data,
success: function(result+nomer){
$('#result'+nomer).html(result+nomer);
}
});
});
});
$(function(){
$('#minus'+nomer).submit(function(e){
e.preventDefault();
var data = $(this).serialize();
$.ajax({
type: "POST",
url: "minus.php",
data: data,
success: function(result+nomer){
$('#result'+nomer).html(result+nomer);
}
});
});
});
</script>
<?
echo'<tr class="'.$color.'">
<td class="t_title">'.$cat['name'].'</td>
<td>'.$cat['characteristic'].'</td>
<td>
<form method="POST" action="" id="minus" style="float:right">
<input class="serle" name="test" value="'.$id.'">
<input onclick="minus()" id="result" type="submit" value=" – ">
</form>
<span style ="margin-left:3px" id="inc'.$id.'">'.$zamowienie[$id].'</span> шт.
<form method="POST" action="" id="plus" style="float:left">
<input class="serle" name="test" value="'.$id.'">
<input onclick="plus()" id="result" type="submit" value=" + ">
</form>
</td>
<td>'.$cat['price'].' р</td>
<td class="nie_maly">2000 р</td>
</tr>';
?>
<script>
var inc=<?=$zamowienie[$id]?>;
function minus() {
inc=inc-1;
if(inc>0){
inc=inc;
}
else{inc=0}
document.getElementById("inc"+nomer).innerHTML = inc;
}
</script>
<script>
var inc=<?=$zamowienie[$id]?>;
function plus() {
inc=inc+1;
document.getElementById("inc"+nomer).innerHTML = inc;
}
</script>
<?
}
}
?>
|