0

我有从其他网站获取 RSS 的代码

gfeedfetcher.prototype._displayresult=function(feeds){
    var rssoutput=(this.itemcontainer=="<li>")? "<ul>\n" : ""
    gfeedfetcher._sortarray(feeds, this.sortstring)
    for (var i=0; i<feeds.length; i++){
        var itemtitle="<a href=\"" + feeds[i].link + "\" target=\"" + this.linktarget + "\" class=\"titlefield\">" + feeds[i].title + "</a>"
        var itemlabel=/label/i.test(this.showoptions)? '<span class="labelfield">['+this.feeds[i].ddlabel+']</span>' : " "
        var itemdate=gfeedfetcher._formatdate(feeds[i].publishedDate, this.showoptions)
        var itemdescription=/description/i.test(this.showoptions)? "<br />"+feeds[i].content : /snippet/i.test(this.showoptions)? "<br />"+feeds[i].contentSnippet  : ""
        rssoutput+=this.itemcontainer + itemtitle + " " + itemlabel + " " + itemdate + "\n" + itemdescription + this.itemcontainer.replace("<", "</") + "\n\n"
    }
    rssoutput+=(this.itemcontainer=="<li>")? "</ul>" : ""
    this.feedcontainer.innerHTML=rssoutput
}

然后我需要通过javascript在数据库这个代码上插入新表的标题和链接

4

1 回答 1

0

ajax 请求示例:

$.ajax({
  type: "POST", // or GET
  url: "databasehandler.php",
  data: { feedtitle: "Some Title", feedlink: "Some URL" }
}).done(function( msg ) {
  alert( "Data Saved: " + msg );
});

--

数据库处理程序.php

<?php

     print_r($_POST);

     // 
     // Do your database handles here.
     // Connect, Query, then return success/failure status

?>
于 2012-06-24T14:09:56.077 回答