Posts: 1
Threads: 1
Joined: May 2017
I'm trying to see if I can integrate into the Blog,
www.bludit.com, by creating a plugin for it.
Although the Comments form appears and can be populated, nothing happens when the Add Comment or Preview buttons are pressed.
The Javascript code that supports the button is in a script tag and I've not found a way to debug it.
I'm guessing that the Ajax code is not working.
I know that Commentics works with a very simple installation and using the example1.php file.
Can anyone suggest what the problem might be, or a method to debug the event from these buttons
Thx
Posts: 2,889
Threads: 59
Joined: Jun 2010
The best thing would be to open your browser's developer tools (F12) and look for any JavaScript errors, look to see if the Ajax request is firing, whether the Ajax request is going to the right URL and what it returns.
If you share a link to the page you're integrating Commentics into then I don't mind checking the above for you.
Have
you completed
the interview?
Posts: 7
Threads: 0
Joined: Jan 2018
(19-May-2017, 07:55 PM)Steven Wrote: The best thing would be to open your browser's developer tools (F12) and look for any JavaScript errors, look to see if the Ajax request is firing, whether the Ajax request is going to the right URL and what it returns.
If you share a link to the page you're integrating Commentics into then I don't mind checking the above for you.
I have the exact same thing happening. New install, went without a single glitch. All systems green. I've logged in as admin and cleaned up all the Dashboard tasks successfully and did a bit of disabling form fields I don't need to see. The add comment form displays perfectly. But Add and Preview buttons don't do anything. Here's my error message:
path.../frontend/index.php?route=main/form/submit Failed to load resource: the server responded with a status of 500 (Internal Server Error)
It looks like the path to 'submit' should be: controller/main/form Although 'form' is form.php and not a directory. What do I need to edit to fix this? Or is something else wrong as well?
Thank you, Michael Wassil
Posts: 2,889
Threads: 59
Joined: Jun 2010
Hi Michael,
The path looks fine to me.
With a 500 error you'll need to check your server's error log to find out the actual reason.
Have
you completed
the interview?
Posts: 7
Threads: 0
Joined: Jan 2018
Thank you. I looked in the server log and expected to find the 500 errors, but nothing there. However, I just tried to comment again and the browser error console shows this:
XMLHttpRequest cannot load http://[URL]/frontend/index.php?route=main/form/submit. Origin http://[URL] is not allowed by Access-Control-Allow-Origin.
I checked the file 'form.php' and changed its permissions to 755 because I had found before that sometimes PHP files on my server must be that or they won't execute. But it didn't help. So what exactly is "Access-Control-Allow-Origin"?
I also commented out the .htaccess file in the base URL of Commentics on the chance it might be the problem. Did not help.
Posts: 7
Threads: 0
Joined: Jan 2018
(03-Jan-2018, 09:38 AM)amwassil Wrote: Thank you. I looked in the server log and expected to find the 500 errors, but nothing there. However, I just tried to comment again and the browser error console shows this:
XMLHttpRequest cannot load http://[URL]/frontend/index.php?route=main/form/submit. Origin http://[URL] is not allowed by Access-Control-Allow-Origin.
I checked the file 'form.php' and changed its permissions to 755 because I had found before that sometimes PHP files on my server must be that or they won't execute. But it didn't help. So what exactly is "Access-Control-Allow-Origin"?
I also commented out the .htaccess file in the base URL of Commentics on the chance it might be the problem. Did not help.
"Access-Control-Allow-Origin" is Apache .htaccess stuff. I'm running Commentics from a subdomain and accessing it from the primary domain. The .htaccess file causing the problem is in the subdomain.
Neither of these work:
Access-Control-Allow-Origin: http://[primary domain]
Access-Control-Allow-Origin: *
I would really like to keep Commentics in a subdomain, but is that going to prevent it working at all? Thanks.
Posts: 7
Threads: 0
Joined: Jan 2018
(03-Jan-2018, 09:52 AM)amwassil Wrote: (03-Jan-2018, 09:38 AM)amwassil Wrote: Thank you. I looked in the server log and expected to find the 500 errors, but nothing there. However, I just tried to comment again and the browser error console shows this:
XMLHttpRequest cannot load http://[URL]/frontend/index.php?route=main/form/submit. Origin http://[URL] is not allowed by Access-Control-Allow-Origin.
I checked the file 'form.php' and changed its permissions to 755 because I had found before that sometimes PHP files on my server must be that or they won't execute. But it didn't help. So what exactly is "Access-Control-Allow-Origin"?
I also commented out the .htaccess file in the base URL of Commentics on the chance it might be the problem. Did not help.
"Access-Control-Allow-Origin" is Apache .htaccess stuff. I'm running Commentics from a subdomain and accessing it from the primary domain. The .htaccess file causing the problem is in the subdomain.
Neither of these work:
Access-Control-Allow-Origin: http://[primary domain]
Access-Control-Allow-Origin: *
I would really like to keep Commentics in a subdomain, but is that going to prevent it working at all? Thanks.
This is NOT an Apache .htaccess issue. I think I need to add "Access-Control-Allow-Origin: http://[primary domain]" to the header of frontend/index.php. Tried that, too, to no avail.
Posts: 7
Threads: 0
Joined: Jan 2018
I was correct. It was the subdomain causing the problem. By changing that to a simple directory and changing the site system settings, I can now post comments successfully.
I am going to attempt to figure out how to get Commentics to work out of a subdomain. That is my preference if it's possible.
Posts: 2,889
Threads: 59
Joined: Jun 2010
I haven't tested this but you might try opening /frontend/index.php
Replace this:
PHP Code:
<?php
if (!headers_sent()) {
header('Content-Type: text/html; charset=utf-8');
}
With this:
PHP Code:
<?php
if (!headers_sent()) {
header('Content-Type: text/html; charset=utf-8');
header('Access-Control-Allow-Origin: *');
}
If that works you could then lock it down by changing the * to your own domain.
Let me know how it goes.