获取有关jquery ajax成功的数据

时间:2013-11-12 20:46:42

标签: javascript jquery

任何人都知道如何从jjery从ajax返回的数据中打开<table> to </table>

// BEGIN Subsys_JsHttpRequest_Js
Subsys_JsHttpRequest_Js.dataReady(
  '3599', // this ID is passed from JavaScript frontend
  '<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">\n          <tr>\n            <td>\n       <script type=\"text/javascript\" language=\"javascript\" src=\"includes/ajax_sc.js\"></script>\n   <div id=\"divShoppingCard\">\n\n    <div class=\"infoBoxHeading\"><a href=\"shopping_cart.php\">Shopping Cart</a></div>\n\n    <div>\n    <div class=\"boxText\">\n<script language=\"javascript\" type=\"text/javascript\">\nfunction couponpopupWindow(url) {\n  window.open(url,\"popupWindow\",\"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=450,height=280,screenX=150,screenY=150,top=150,left=150\")\n}\n//--></script><table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><tr><td align=\"left\" valign=\"top\" class=\"infoBoxContents\"><span class=\"infoBoxContents\">1&nbsp;x&nbsp;</span></td><td valign=\"top\" class=\"infoBoxContents\"><a href=\"http://beta.vikingwholesale.com/catalog/eagle-vanguard-limited-edition-p-3769.html\"><span class=\"infoBoxContents\">192 Eagle Vanguard Limited Edition</span></a></td></tr><tr><td align=\"left\" valign=\"top\" class=\"infoBoxContents\"><span class=\"newItemInCart\">4&nbsp;x&nbsp;</span></td><td valign=\"top\" class=\"infoBoxContents\"><a href=\"http://beta.vikingwholesale.com/catalog/family-traditions-adrenaline-avid-black-p-3599.html\"><span class=\"newItemInCart\">085 Family Traditions Adrenaline - Avid, Black</span></a></td></tr><tr><td align=\"left\" valign=\"top\" class=\"infoBoxContents\"><span class=\"infoBoxContents\">1&nbsp;x&nbsp;</span></td><td valign=\"top\" class=\"infoBoxContents\"><a href=\"http://beta.vikingwholesale.com/catalog/painted-pony-paradigm-p-4022.html\"><span class=\"infoBoxContents\">336 Painted Pony Paradigm</span></a></td></tr></table></div>\n\n\n    <div class=\"boxText\"><img src=\"images/pixel_black.gif\" width=\"100%\" height=\"1\" alt=\"\"/></div>\n\n\n    <div class=\"boxText\">$940.00</div>\n\n\n</div>\n\n\n          \n         </div><!--end of divShoppingCard-->\n       </td>\n     </tr></table>',
  null
)
// END Subsys_JsHttpRequest_Js

1 个答案:

答案 0 :(得分:0)

这就是我最终做的事情,不确定它与网站其他部分的兼容性。

$text = $this->_php2js(stripslashes(trim(html_entity_decode($text, ENT_QUOTES))));
/* 
$text = 
    "// BEGIN Subsys_JsHttpRequest_Js\n" . 
    "Subsys_JsHttpRequest_Js.dataReady(\n" . 
        "  " . $this->_php2js($this->SCRIPT_ID) . ", // this ID is passed from JavaScript frontend\n" . 
        "  " . $this->_php2js(trim($text)) . ",\n" . 
        "  " . $result . "\n" . 
    ")\n" . 
    "// END Subsys_JsHttpRequest_Js\n" . 
"";
 * 
 */ 

由于