Great! thanks!
few more questions, what If i have more that one field and I use this javascript
:
Code:
<script type="text/javascript">
$('.responseForm1').submit(function(){$('input[type=submit]', this);});
function parseResponse () {
var code = $("#hiddenField2");
var n1 = $("#n1");
var url = "news_parse1.php";
$.post(url,{ code: code.val(), n1: n1.val()} , function(data) {
});
$.ajax({
type:"POST",
url:"news_load1.php",
data:"getNews=true",
success: function(r){
$("#newsContent").html(r)
var textbox = document.getElementById('code');
textbox.value ="";
},
error: function(){
alert($(".hiddenField2").val()); $("#error").text($("#hiddenField23")).fadeIn(300)
}
})
}
</script>
and lets say this repeats twice, with different php values cause of a loop:
Code:
<form action="javascript:parseResponse();" class="responseForm1">
<input type="hidden" name="hiddenField" id="hiddenField" value="<?php echo $product; ?>" />
<input type="text" name="hiddenField2" id="hiddenField2" class="hiddenField2" value="<?php echo $id; ?>" />
<input type="hidden" name="hiddenField1" id="hiddenField1" value="<?php echo $price; ?>" />
<input type="submit" name="submit" class="submit" value="<?php echo $final1; ?>" style="left: 0px; background-color:lightgreen; height:70px; width:100px;"> </form>
<form action="javascript:parseResponse();" class="responseForm1">
<input type="hidden" name="hiddenField" id="hiddenField" value="<?php echo $product; ?>" />
<input type="text" name="hiddenField2" id="hiddenField2" class="hiddenField2" value="<?php echo $id; ?>" />
<input type="hidden" name="hiddenField1" id="hiddenField1" value="<?php echo $price; ?>" />
<input type="submit" name="submit" class="submit" value="<?php echo $final1; ?>" style="left: 0px; background-color:lightgreen; height:70px; width:100px;"> </form>
How do I modify my JS code so that it will work for which ever form is submitted.