0
Welcome Guest! Login
0 items Join Now

Ajax Call not loading properly

  • Ajax Call not loading properly

    Posted 12 years 1 month ago
    • After much proof reading I am stuck as to why I'm not getting the expected results. I'm getting anything but the current gantry version on the alert box. Initially, the function would not even load, but now it actually responds.

      The problem? It's loading the entire source page on the alert box, instead of just the gantry version. I'm trying this on the index page of a premium theme, which I did not think it would make a difference, but here is some more information:

      Inline code on index's header:
              $gantry->addInlineScript("
              window.addEvent('domready', function() {
              
                 var logo = $('rt-logo');
                  logo.addEvent('click', function(e) {
                  e.stop();
                  
                  new Request({
                    url: 'http://localhost:8888/".$gantry->baseUrl."?tmpl=gantry-ajax',
                    onSuccess: function(response) {alert('This response: '+response);}
                  }).post({
                       'model': 'which-version',
                       'message': 'The current version of Gantry you are currently using is'
                  });
                    });
              
              });");

      Code on mysite.com/wp-content/themes/rt_enigma_wp/ajax-models/which_version.php
      <?php
      defined('JPATH_BASE') or die();
      global $gantry;
       
      $message = JRequest::getVar('message', '');
      $version = (defined('GANTRY_VERSION')) ? GANTRY_VERSION : 'Unknown Version';
       
      echo $message . " " . $version;
       
       
      ?>

      Result at the alert box (gets cut off):
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" >
      <head>
          <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
      <title>Site Title</title>
      <meta name='robots' content='noindex,nofollow' />
      <link rel="alternate" type="application/rss+xml" title="Site Title &raquo; Feed" href="http://localhost:8888/nextwp/feed/" />
      <link rel="alternate" type="application/rss+xml" title="Site Title &raquo; Comments Feed" href="http://localhost:8888/nextwp/comments/feed/" />
      <link rel='stylesheet' id='thickbox-css'  href='http://localhost:8888/nextwp/wp-includes/js/thickbox/thickbox.css?ver=20121105' type='text/css' media='all' />
      <link rel='stylesheet' id='rok_showcase_css-css'  href='http://localhost:8888/nextwp/wp-content/themes/rt_enigma_wp/roksprocket/layouts/features/themes/showcase/showcase.css?ver=3.5.1' type='text/css' media='all' />
      <link rel='stylesheet' id='grid-12567-css'  href='http://localhost:8888/nextwp/wp-content/plugins/gantry/css/grid-12.css?ver=1.31' type='text/css' media='all' />
      <link rel='stylesheet' id='gantry51-css'  href='http://localhost:8888/nextwp/wp-content/plugins/gantry/css/gantry.css?ver=1.31' type='text/css' media='all' />
      <link rel='stylesheet' id='wordpress116-css'  href='http://localhost:8888/nextwp/wp-content/plugins/gantry/css/wordpress.css?ver=1.31' type='text/css' media='all' />
      <link rel='stylesheet' id='wordpress751-css'  href='http://localhost:8888/nextwp/wp-content/themes/rt_enigma_wp/css/wordpress.css?ver=1.31' type='text/css' media='all' />
      <link rel='stylesheet' id='demo-styles292-css'  href='http://localhost:8888/nextwp/wp-content/themes/rt_enigma_wp/css/demo-styles.css?ver=1.31' type='text/css' media='all' />
      <link rel='stylesheet' id='style552-css'  href='http://localhost:8888/nextwp/wp-content/themes/rt_enigma_wp/css/style5.css?ver=1.31' type='text/css' media='all' />
      <link rel='stylesheet' id='typography325-css'  href='http://localhost:8888/nextwp/wp-content/themes/rt_enigma_wp/css/typography.css?ver=1.31' type='text/css' media='all' />
      <link rel='stylesheet' id='extensions736-css'  href='http://localhost:8888/nextwp/wp-content/themes/rt_enigma_wp/css/extensions.css?ver=1.31' type='text/css' media='all' />
      <link rel='stylesheet' id='extensions-style5958-css'  href='http://localhost:8888/nextwp/wp-content/themes/rt_enigma_wp/css/extensions-style5.css?ver=1.31' type='text/css' media='all' />
      <link rel='stylesheet' id='template653-css'  href='http://localhost:8888/nextwp/wp-content/themes/rt_enigma_wp/css/template.css?ver=1.31' type='text/css' media='all' />
      <link rel='stylesheet' id='template-gecko648-css'  href='http://localhost:8888/nextwp/wp-content/themes/rt_enigma_wp/css/template-gecko.css?ver=1.31' type='text/css' media='all' />
      <link rel='stylesheet' id='wp399-css'  href='http://localhost:8888/nextwp/wp-content/themes/rt_enigma_wp/css/wp.css?ver=1.31' type='text/css' media='all' />
      <link rel='stylesheet' id='fusionmenu222-css'  href='http://localhost:8888/nextwp/wp-content/themes/rt_enigma_wp/css/fusionmenu.css?ver=1.31' type='text/css' media='all' />
      <link rel='stylesheet' id='rokbox-style.css-css'  href='http://localhost:8888/nextwp/wp-content/plugins/wp_rokbox/themes/light/rokbox-style.css?ver=3.5.1' type='text/css' media='all' />
      <link rel='stylesheet' id='rokajaxsearch.css-css'  href='http://localhost:8888/nextwp/wp-content/plugins/wp_rokajaxsearch/css/rokajaxsearch.css?ver=3.5.1' type='text/css' media='all' />
      <link rel='stylesheet' id='rokajaxsearch-theme.css-css'  href='http://localhost:8888/nextwp/wp-content/plugins/wp_rokajaxsearch/themes/light/rokajaxsearch-theme.css?ver=3.5.1' type='text/css' media='all' />
      <link rel='stylesheet' id='roknewspager.css-css'  href='http://localhost:8888/nextwp/wp-content/plugins/wp_roknewspager/themes/light/roknewspager.css?ver=3.5.1' type='text/css' media='all' />
      <link rel='stylesheet' id='roktabs.css-css'  href='http://localhost:8888/nextwp/wp-content/plugins/wp_roktabs/tmpl/light/roktabs.css?ver=3.5.1' type='text/css' media='all' />
      <link rel='stylesheet' id='rokstories_css-css'  href='http://localhost:8888/nextwp/wp-content/plugins/wp_rokstories/tmpl/css/rokstories.css?ver=3.5.1' type='text/css' media='all' />
      <link rel="stylesheet" href="http://localhost:8888/nextwp/wp-content/themes/rt_enigma_wp-child/style.css" type="text/css"/>
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
      <link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://localhost:8888/nextwp/xmlrpc.php?rsd" />
      <link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://localhost:8888/nextwp/wp-includes/wlwmanifest.xml" /> 
      <link rel='prev' title='Sample Page' href='http://localhost:8888/nextwp/sample-page/' />
      <link rel='next' title='Blog' href='http://localhost:8888/nextwp/blog/' />
      <meta name="generator" content="WordPress 3.5.1" />
      <link rel='canonical' href='http://localhost:8888/nextwp/' />
       
       
       
      <style type="text/css">.fancybox-hidden{display:none}</style>
          <style type="text/css">
              <!--
       
       
      body #rt-logo {width:395px;height:60px;}
              -->
          </style>
          
          
      </head>
          <body  class="home page page-id-131 page-template page-template-homepage-php backgroundlevel-high cssstyle-style5 readonstyle-button font-family-enigma font-size-is-default typography-style-light col12">
              <div id="rt-top-surround"><div id="rt-top-surround2"><div id="rt-top-surround3">
                              <div id="rt-drawer">
                      <div class="rt-container">
                                  <div class="rt-grid-12 rt-alpha rt-omega">
                 

      :cry: I don't know what I am doing wrong!
    • Last Edit: 9 years 4 months ago by Kat05.
    • Shazdeh's Avatar
    • Shazdeh
    • Elite Rocketeer
    • Posts: 4984
    • Thanks: 29

    Re: Ajax Call not loading properly

    Posted 12 years 1 month ago
    • Hi,
      I think (and I could be wrong) that the Gantry Ajax system is for Joomla platform and the API is not finished for WordPress. Though, WordPress has a built-in Ajax API, you can look into that. Please visit this codex page for more info:
      codex.wordpress.org/AJAX_in_Plugins
    • Please don't PM unless requested ;)
      Consider using the custom stylesheet for all your CSS customizations: gantry-framework.org/documentation/wordp...custom_stylesheet.md .
      Please provide the URL to the issue.
      And please mark the thread as solved if the issue is resolved.
  • Re: Ajax Call not loading properly

    Posted 12 years 1 month ago
    • Thank you, Shaz. I'll go that route instead then.

Time to create page: 0.064 seconds