[mapserver-users] Accessing external files using javascript (other)

Robert Crossley robert at wotzhere.com
Tue Apr 16 17:53:56 EDT 2002



17/04/2002 04:08:03, "Ryan, Adam" <ARyan at co.linn.or.us> wrote:

>
>Hi folks,
>
>I'm new to HTML/JavaScript.  Is there a simple way to make calls to an
>external file using javascript (other script)? Access, dBase, text file,
>anything?  I want to manipulate my returned template according to some
>values saved elsewhere.
>

Adam, 
I had a similar dilema.  The problem a I saw it was there was a limited amount you could do on the template in terms of server side processing.
I ended up doing this by putting a redirection to an asp page on the template, and getting data from a database using server side scripting.  

In this way I was able to pass a value of the ID for an object selected from the map to that page and do what I wanted with it.  The template code for the 
body is provided blelow, and you do not need to specify a web header, footer or template header in the map file.  In this example, the PadID is replaced by 
mapserver to be the value of C_LINKCODE found for the object in the search, and a second parameter is also passed for query type.

Once on an asp page, you can access databases using standard asp scripting if your on a windows server.  Others may be able to tell you options on unix 
etc. using other scripting languages that can call databases.

Good Luck
Rob

Template code follows.


<!--Start of Page Body-->
<HTML>

<noscript>
<meta http-equiv="refresh" content="1; URL=redirectiontarget.asp">
</noscript>

<BODY>

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
window.location="/queries/QueryDisplay.asp?PadId=[C_LINKCODE]&QType=Harvest";
// End -->
</script>

<noscript>
It appears that your browser does not support JavaScript, or you have it disabled.  This site is best viewed with JavaScript enabled.<p>If JavaScript is 
disabled in your browser, please turn it back on then reload this page.<p>Or, if your browser does not support JavaScript, 
click <a href="http://203.1.68.230/fmapweb/queries/QueryDisplay.asp?PadId=[C_LINKCODE]&QType=Harvest">here</a>.
</noscript>

</HTML>


>

Robert Crossley 
Robert Crossley & Associates
9 Short St
New Brighton NSW 2483
AUSTRALIA

P: 02 6680 1309
F: New Connection
M: 0419 718 642
E: robert at wotzhere.com






More information about the mapserver-users mailing list