对模块的Ajax调用没有返回任何东西


Ajax call to module not returning anything

我的目标是能够使用magento从html页面生成pdf。我卡住了,但是在成功地做一个ajax请求。

我得到了我的ajax调用的工作,但它没有返回什么我在我的Specsheetpdf。phtml文件。

我可能做错了,我是新手。

在视图。在主题文件夹中,我有这个代码,当单击按钮调用specsheetpdf时使用ajax。生成pdf的php文件:

jQuery(document).ready(function() {
    jQuery( "input#printPDF_RDT" ).click(function() {
        //get all value
        var prod_name = jQuery("#product_name_RDT").text();
        var prod_details = jQuery(".box-description .std").html();
        var prod_image = jQuery(".product-image #image").attr('src');
        //Before we get the options html we need to wrap it around a div to make things easy
        jQuery("#product-options-wrapper").wrap("<div id='product_options_RDT'></div>");
        //Now get the html in the created div
        var prod_options = jQuery("#product_options_RDT").html();
        var prod_sku = jQuery("#showsku").text();
        // Do AJAX call to makePDF.php
        jQuery.ajax({
            type: "POST",
            url: "<?php echo $this->getUrl('specsheetpdf/ajax/index') ?>",
            data: { product_name: prod_name , product_details: prod_details,
                    product_image: prod_image, options_html : prod_options, 
                    product_sku : prod_sku },
            success: function(data) {
                    jQuery('#results_rdt').html(data);
            }
        });
    });
});

作为测试的规格表pdf。php应该与产品名称相呼应,但现在我得到了一个空白的主体模板。如果这说得通的话。它返回网页的HTML,正文中没有内容。

这是我的代码模块我做:

应用程序/代码/地方/Rdtmodules/Specsheetpdf/控制器/AjaxController.php

class Rdtmodules_Specsheetpdf_AjaxController extends Mage_Core_Controller_Front_Action {
    public function indexAction() {
        $this->loadLayout();
        $this->renderLayout();
    }
}

app/代码/地方/Rdtmodules/Specsheetpdf/etc/config . xml

<?xml version="1.0"?>
<config>
  <modules>
    <Rdtmodules_Specsheetpdf>
      <version>0.1.0</version>
    </Rdtmodules_Specsheetpdf>
  </modules>
  <frontend>
    <routers>
      <Specsheetpdf>
        <use>standard</use>
        <args>
          <module>Rdtmodules_Specsheetpdf</module>
          <frontName>specsheetpdf</frontName>
        </args>
      </Specsheetpdf>
    </routers>
    <layout>
      <updates>
        <specsheetpdf>
          <file>specsheetpdf.xml</file>
        </specsheetpdf>
      </updates>
    </layout>
  </frontend>
</config>

应用程序/etc/模块/Rdtmodules_Specsheetpdf.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Rdtmodules_Specsheetpdf>
             <active>true</active>
             <codePool>local</codePool>
        </Rdtmodules_Specsheetpdf>
    </modules>
</config>

前端/违约/默认布局/specsheetpdf.xml

<?xml version="1.0"?>
<layout version="1.0">
  <specsheetpdf_ajax_index>
    <block type="specsheetpdf/specsheetpdf" name="root" output="toHtml" template="specsheetpdf/specsheetpdf.phtml" />
  </specsheetpdf_ajax_index>
</layout>

前端/违约/违约/模板/specsheetpdf/specsheetpdf.phtml

$product_name = $_POST['product_name'];
$product_details = $_POST['product_details'];
$product_image = $_POST['product_image'];
$options_html = $_POST['options_html'];
$product_sku = $_POST['product_sku'];
echo $product_name;

我做错了什么吗?非常感谢您的帮助。

它起作用了:事实证明,当我把信息放在这里时,我纠正了自己:好吧,希望这对其他人也有帮助:)