if you can edit the title please do!
Revised version!!! This is main.php
$(document).ready(function(e)
{
$("#searchForm").submit(function(e)
{
e.preventDefault();
$("#result").load("process_search.php",{"searchKeyID":$("#searchKeyID").val()}, function(response,status)
{
alert(response);
});
});
});
<body>
<form id="searchForm" method="post">
<table>
<tr>
<td> <input type="text" id="searchKeyID" /> </td>
<td> <input type="submit" id="searchButtonID" value="Search" /> </td>
</tr>
</table>
</form>
<div id="result"></div>
</body>
This is process_search.php
//search is done
echo json_encode($results);
print_r will show me the contents of the array in a non organized manner. I'm fully aware that I can just echo it in process.php in an organized way so that it'll appear in main.php as a proper organization of data. However, I want the array/obj to return to main and IN MAIN, the organized printing takes place. This is where I put ????? in my code
How can I do that?
I came across this link. Made me more confused. I don't know how the answer that got 57 votes works. How is it printing the second index. I copied the code the way it is and ran it. It printed the Damskie and Muskie. How did it know which index/val to go after?
If I type alert(response); in place of the question marks, it works. I see the entire obj/array properly organized. I did see topics for printing an array but not like a record. ... I forgot to look for sites that print records in jquery :D ill look right away
EDIT: i figured out how the code in the link I included worked.