java or jquery script to run a php script saved as a seperate .php file on server


I am working with a server side scripting language that does not allow php to be used directly in conjunction with the server side templates, so to work around it, I am hoping that there is a way that I can through Java, call the PHP script which will be saved as a separate PHP file on my web server, which I believe should work around the problem. Im assuming this is possible in javascript or jquery if that would be easier. Anyways, I installed wordpress on a subdomain on my site, so basically I am trying to import blog posts from word press into my main home page template which is managed through the server side scripting form. Hopefully that makes sense.

Anyways Im including the php code from the wordpress import so basically lets assume the wordpress code im posting is saved as "wordpressNews.php" on my webserver.


$posts = get_posts('numberposts=10&order=ASC&orderby=post_title');
foreach ($posts as $post) : start_wp(); ?>
<?php the_date(); echo "<br />"; ?>
<?php the_title(); ?>    
<?php the_excerpt(); ?> 

Open in new window

Who is Participating?
anoyesConnect With a Mentor Commented:
You could certainly use jQuery to load up the RSS feed from wordpress, parse it, and add it to the page.  Here's an example from something I've used in the past, which will put a place holder (blogFeed) onto the page and then fill it with the results that Wordpress returns.

<script type="text/javascript">
  $(document).ready(function() {
    $.get('/path/to/wordpressNews.php', function(resp) {
      $(resp).find('item').each(function() {
        var i = $(this);
        var title = i.find('title').text();
        var desc = i.find('description').text();
        $('#blogFeed').append('<h2>' + title + '</h2>');
        $('#blogFeed').append('<p>' + desc + '</p>');

<div id="blogFeed">
  <p>Please wait while content is loaded...</p>

Open in new window

All Courses

From novice to tech pro — start learning today.