SeedCode Logo

a JavaScript approach to FileMaker Custom Web Publishing™

gh LogoDownload on GitHub

Do the data interchange work with JavaScript.

Query strings are created from JavaScript Objects and then sent as an HTTP POST to FileMaker's XML Web Publishing Engine. An XML FMPXMLRESULT is returned and converted into JavaScript Objects/JSON by fmxj.

HTTP POSTS can be done directly to the FileMaker Server's XML WPE or a simple PHP relay can be used to get around cross-domain issues and provide more authentication options. See more on the PHP relay in the postQueryFMS() function.


Create a HTTP request to the hosted filemaker file "Events". Target layout in the specified file is "Events". Query is created by the findRecordsURL() function and passed as the query argument to the postQueryFMS() function. The required handler for onreadystateexchange is defined as well as the optional onprogress handler.

var requests =	[ //create find requests for query. each object is request.
	{ "DateStart" : "<=2/28/2014" , "DateEnd" : ">=2/1/2014" },
	{ "DateStart" : "2/1/2014...2/28/2014" }
var query = fmxj.findRecordsURL("Events", "Events", requests) ; // create query

function onReadyFuntion(js){ //define handler for onready
	document.getElementById("example1") = JSON.stringify(js, null, 4);
} ;
function onProgressFuntion(n){ //define handler for onprogress
	document.getElementById("example1") += n + " bytes downloaded\n";
} ;
fmxj.postQueryFMS(query, onReadyFunction, onProgressFunction); //make call