attached JS(javascript) files

Hi,

I try import a .js file and everything compile with no problem. but it seems that I can’t execute the function in the .js file.

is it the right way to import the file and setting the MIME as shown below?

part of the source code:

#ximport “sensor1.zhtml” sensor_zhtml
#ximport “graphs.js” js_graphs_lib

SSPEC_MIMETABLE_START
SSPEC_MIME_FUNC(“.html”, “text/html”, zhtml_handler),
SSPEC_MIME(“.js”, “text/javascript”)
SSPEC_MIMETABLE_END

SSPEC_RESOURCETABLE_START
SSPEC_RESOURCE_XMEMFILE(“/index.html”, sensor_zhtml)
SSPEC_RESOURCETABLE_END

Hi Lee, try this:

  1. In the following line:

>>>>#ximport “graphs.js” js_graphs_lib

pu the full path name of of the .js file i.e.

#ximport “/graphs.js” js_graphs_lib

  1. Replace this line:
    >>>>SSPEC_RESOURCE_XMEMFILE(“/index.html”, sensor_zhtml)

with:
SSPEC_RESOURCE_XMEMFILE(“/”, sensor_zhtml)
SSPEC_RESOURCE_XMEMFILE(“/index.html”, sensor_zhtml)
SSPEC_RESOURCE_XMEMFILE(“/graphs.js”, js_graphs_lib)

I hope that works for you.

ajit

Hi Ajit,

Thanks a lot for your advice & help.
It works! Your helps have saved me… i have been spending the past two days on this problem… :slight_smile: