-1

I am new to ajax jquey in programming.I had successfully inserted values which i posted via form field(id,name,age) in my xml file.But i am not printing the correct result in my HTML table.I had to insert the datas in xml file and also display the result in an HTML table.

My ajax jquery code is as follows:

$(document).ready(function() {
$("#myTable").tablesorter( {sortList: [[0,0], [1,0]]} );
$("#login").click(function() {

var action = $("#form1").attr('action');
var form_data = {
id: $("#id").val(),
name: $("#name").val(),
age: $("#age").val(),
is_ajax: 1
};

$.ajax({
type: "POST",
url: "x1.php",
data: form_data,
success: function(response)
{
if(response == 'success')
$("#form1").slideUp('slow', function() {
$("#message").html("

Details are entered into the table!

");
});
else

$("#message").html("

Please enter details

");
$("#message").show();
}
});

return false;
});
});

MY HTML table code is as follows:

id name age <?php foreach($xml as $xmls) { ?> <?php echo "".$xmls->id."";?> <?php echo "".$xmls->name."";?> <?php echo "".$xmls->age."";?> <?php } ?> </div> my XML file contains data result as: <?xml version="1.0"?>

<Order>
<title>
<id>1</id>
<name>baven</name>
<age>45</age>
</title>
<title><id>2</id><name>simi</name><age>22</age></title><title><id>3</id><name>great</name><age>34</age></title></Order>

i would like to output the result in a table as:

id name age
1 baven 45
2 simi 22
3 great 34

I need to get the result not by refreshing the page but by clicking the submit button.Any help would be appreciated..

Edited by bavenbabu: forgot to enter correct reason refreshing

Votes + Comments
Start using code tags!
2
Contributors
5
Replies
6
Views
5 Years
Discussion Span
Last Post by bavenbabu
0

Where it says "Details are entered into the table!" you should output the new HTML table, which should be returned by your PHP insert script.

0

new HTML table is been outputted.But i am getting the result only after refreshing.I dont want to Refresh actually.I need to avoid refreshing the page.

0

new HTML table is been outputted.But i am getting the result only after refreshing.I dont want to Refresh actually.I need to avoid refreshing the page.

0

new HTML table is been outputted.But i am getting the result only after refreshing.I dont want to Refresh actually.I need to avoid refreshing the page.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.