Jump to content

php + jquery = internal server error 500?


ashrai
 Share

Recommended Posts

hey folks,

doing my second website, now. Featuring jquery voodoo stuff, I'm just getting started with.

There's a problem:

I want to replace the content of a div via jquery by using this code:

---snip---

$(document).ready(function()
{
    $("#sidebar a, #cycle a").live("click",function()
    {
        var pageToLoad = $(this).attr("href");    
        $("#cycle").load(pageToLoad);
        
        return false;
    });
});
---snip---
 
It all works well if I just use html or standard php syntax like "echo".
But:
When I try to get some URLS out of Processwire, like this:
 
---snip---
<?php
$logochild = $pages->get('/referenzen/logos/')->children('limit=1, sort=-date');
foreach ($logochild as $k => $n) {
echo "<div id='col0'>";
echo "<div style='ref'>";
echo "<img class='refimage_home' src='{$n->ref_image->url}' alt='{$n->ref_image->description}' /></div>";
}
echo "</div>";
?>
---snip---
 
I get an internal server error 500 and nothing is displayed inside my div. The code works and if placed inside my index.php, everything is running fine. Where's the problem? Maybe the permissions? 
 
thanks for help,
Ashrai
 
//edit:
the script is stored outside the templates folder, in "site/script".
The various files I want to load on demand are also there.
Also, there's a reason i use "limit=1. The list will be expanded later, when more children have been added and to be flexible with the design, which is not final at the moment.
Link to comment
Share on other sites

It's hard to tell, as your javascript doesn't make much sense with the php/html you posted. There's no link and no href. Also I don't understand what a index.php has to do with all this, guess it's a plain php you created without PW? And I don't know what scripts you're talking about you have in site/script.

Really hard to help without asking a lot of questions, that's maybe why nobody yet responded.

Link to comment
Share on other sites

I get an internal server error 500 and nothing is displayed inside my div. The code works and if placed inside my index.php, everything is running fine. Where's the problem? Maybe the permissions? 

First thing you should always do when having problems is checking your error logs, both for PW (site/assets/logs/errors.txt) and Apache (usually /var/log/apache2/error.log.)

Does anything show up there when this error occurs?

Link to comment
Share on other sites

Thanks, I'll take a look inside the error logs and turn on debugging.

@soma:

the script has nothing to do with the php code - at least not directly. It just replaces the content of a div. As long as I load plain html, everything works well. The moment I load the php script (which works, as long it's just within the code of my main (starting) page, named index.php) I get an internal server error.

Ok, I'll post what's within the logs next monday, as I'm afk until sunday. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...