ROM
asked on
JQuery load php file - 500 - I think it might be CORS
Hi All,
I am changing a Joomla 3.9 view I made to load only parts of DIVs instead of the whole page with JQuery.
So I cut up my working view and deleted the "changeable part".
Moved the "changeable part" into a separate php file, same web server, same domain.
But when I try to $("#loaddivhere").load("components/com_mycomp/views/myview/tmpl/mydiv.php");
I receive a 500 Get error.
And I think it might be CORS.
The general section of the NETWORK inspector is:
What am I doing wrong that CORS is kicking in.... ? Or maybe it should as it is an external file.
My goal is to refresh specific divs (or single div in this test case) so I can have a fluid UX.
Please help.
Many thanks in advance
R
I am changing a Joomla 3.9 view I made to load only parts of DIVs instead of the whole page with JQuery.
So I cut up my working view and deleted the "changeable part".
Moved the "changeable part" into a separate php file, same web server, same domain.
But when I try to $("#loaddivhere").load("components/com_mycomp/views/myview/tmpl/mydiv.php");
I receive a 500 Get error.
And I think it might be CORS.
The general section of the NETWORK inspector is:
- Request URL:
https://sub.mydomain.com/administrator/components/com_mycomp/views/myview/tmpl/mydiv.php - Request Method:
GET - Status Code:
500 - Remote Address:
195.195.195.195:443
Referrer Policy:
strict-origin-when-cross-origin
What am I doing wrong that CORS is kicking in.... ? Or maybe it should as it is an external file.
My goal is to refresh specific divs (or single div in this test case) so I can have a fluid UX.
Please help.
Many thanks in advance
R
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Slight correction... if you do not want to see a nest of 2x MYDIVS.... then I wrapped my div within a submydiv... and did the following:
$("#mydiv").load(location.href + " #submydiv");
This then did not duplicate the mydiv... works great
R
$("#mydiv").load(location.href + " #submydiv");
This then did not duplicate the mydiv... works great
R
ASKER
NO NEED to separate out file. All contained within one file again.
Answer is to specify the reload and the div at the same time.
e.g.
Open in new window
I won't delete question as this is the answer for what I needed.