I have a form where i show a google map.... In the init of the form (we made together with Thierry some time ago) i have this code:
Lparameters lcUser, lcHTML
If Pcount() > 0
DoDefault()
lcFile = JustFname(lcHtml)
local oAJAX as awAJAX of awServer.prg
if wlAJAX(@m.oAJAX)
m.oAJAX.cScriptjsAdd(Textmerge([$('<<this.cntWeb.wcID>>').src="Maps/<<m.lcFile>>";]))
EndIf
Here i receive a full local path of an html file generated to show a google map result... I have no error message and lcHtml is set corrected and it is in "Maps" folder When the form is shown nothing appears And if look in html properties i can see this:
And if i manually set src="maps\239847.html" (239847.html is the value of m.lcFile) the page is shown correctly Why i have "unknown" ?
"maps..." instead of "Maps..." ?
Nothing changes...
I think the #
is missing
m.oAJAX.cScriptjsAdd(Textmerge([$('#<<this.cntWeb.wcID>>').src="Maps/<<m.lcFile>>";]))
And this ?
m.oAJAX.cScriptjsAdd(Textmerge([$('#<<this.cntWeb.wcID>>').attr("src", "Maps/<<m.lcFile>>");]))
Now it works... Thanks
Ciao Michele,
This issue is because the code was originally written for prototype.js
(deprecated) and your app. no longer loads this library; both prototype and jQuery use the $()
function, however with a different meaning.
As jQuery is permissive (no error when passing a parameter out of scope), passing an html ID
without the #
selector (prototype syntax) triggers no error even if jQuery finds no matching element.