I’m building a web application which has a primary page which presents records of cars (make, price, year etc…). All of those are organized in an HTML table which is dynamically built from the database each time the page reloads.
At the top of the page (not in the table) there is a New button which opens a new window which presents a form for the user to enter the new car details.
<caption>Cars<button onclick="fn_new();">N</button></caption>
function fn_new(event)
{
var new_window = window.open('/new', "_blank",
"toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, copyhistory=yes, width=350, height=350,top=200,left=400");
}
When the user finishes entering the new car details, a new record is added to the db. When that happens I want to use the ajax jQuery load to refresh the table section again with the new records. something like:
$("#carsTable").load("/getCarsRecordsFromDb");
I do not know where to place this ajax jQuery call (in which event function).
My question is what is the best way to detect at the primary window that a submit was pressed from the new car window ?
In parent window js.
In child window js.