Hi Phil,
First, thanks for looking at this. Your statement makes perfect sense, but I cannot get this to work. As I mentioned I created a new code file by selecting add new code file from the project menu and I got this:
When I go to deploy to local folder. The app complains
Looking at the code I get the message:
Failed to load resource: net::ERR_FILE_NOT_FOUND
Is it possible for you to give me a step by step on how to create the php and then where to save it. When I upload the project to the server, it loads OK except I cannot find HelloWorld.php.
I thought for starters I would make a helloworld.php with NotePad and then save it to my www folder on my server and then type in the address into the browser “https:/www.getmyshot.net/helloworld.php”
I got a reply ( note I modified the php file )
<?php
echo "Hello World Response"
?>
So, It works but I thought the php file would load from the project.
When I put in the AJAX code in my project
Function cmdDoAjax_onclick()
Dim req
req=Ajax(“http://www.getmyshot.net/helloworld.php”, done)
End Function
Function done()
If req.status = 200 Then 'success
lblResponse.value=req.responseText
Else 'failure
msg = "Error: Status = " & req.status
If TypeName(req.statusText)=“string” Then msg = msg & " " & req.statusText
If TypeName(req.err)=“string” Then msg = msg & " " & req.error
MsgBox msg
End If
End Function
I get this error:
Uncaught ReferenceError: req is not defined
at Object.done (code.js:95)
at i (jquery2.js:2)
at Object.fireWith [as rejectWith] (jquery2.js:2)
at z (jquery2.js:4)
at XMLHttpRequest. (jquery2.js:4)
www.getmyshot.net/helloworld.php:1 Failed to load resource: net::ERR_FAILED
index.html:1
Uncaught ReferenceError: req is not defined
at Object.done (code.js:95)
at i (jquery2.js:2)
at Object.fireWith [as rejectWith] (jquery2.js:2)
at z (jquery2.js:4)
at XMLHttpRequest. (jquery2.js:4)
www.getmyshot.net/helloworld.php:1 Failed to load resource: net::ERR_FAILED
index.html:1 Access to XMLHttpRequest at ‘http://www.getmyshot.net/helloworld.php’ from origin ‘null’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
appstudioFunctions.js:1949 Error encountered:
Script error.
Url:
Line: 0
Column: 0
code.js:95 Uncaught ReferenceError: req is not defined
at Object.done (code.js:95)
at i (jquery2.js:2)
at Object.fireWith [as rejectWith] (jquery2.js:2)
at z (jquery2.js:4)
at XMLHttpRequest. (jquery2.js:4)
www.getmyshot.net/helloworld.php:1 Failed to load resource: net::ERR_FAILED
index.html:1 Access to internal resource at 'file:///C:/GET%20MY%20SHOT%20Development/Backup%20GetMyShot%20082121/GetMyShot.appstud
So, it seems I am just not putting the helloworld.php in the right place. Can you help?
Thanks,
Bob Briscoe