Jquery ajax在codeigniter中加载没有页面刷新的注释

时间:2018-01-29 06:57:43

标签: javascript jquery ajax codeigniter

我正在开发一个带有PHP CodeIgniter框架的帖子评论系统。当用户对帖子发表评论时,如果没有页面刷新就加载它。这是我的ajax代码。

dyn.load("/Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home/lib/server/libjvm.dylib")

library(NLP)
library(coreNLP)

> downloadCoreNLP()
trying URL 'http://nlp.stanford.edu/software//stanford-corenlp-full-2015-12-09.zip'
Content type 'application/zip' length 403157240 bytes (384.5 MB)
==================================================
downloaded 384.5 MB

> initCoreNLP()
[main] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Searching for resource: StanfordCoreNLP.properties
Error in rJava::.jnew("edu.stanford.nlp.pipeline.StanfordCoreNLP", basename(path)) : 
  edu.stanford.nlp.io.RuntimeIOException: ERROR: cannot find properties file "StanfordCoreNLP.properties" in the classpath!

我的表单代码是:

var id = $(this).attr("data-id");

    // check to see which events this comment already has
    var events = $._data( this, 'events' ).keypress;

    // Try to find if keypress has already been registered
    // registering it twice causes duplicate comments

    var hasEvents = false;
    for(var i=0;i<events.length;i++) {
        if(events[i].namespace == "") {
            hasEvents = true;
        }
    }

  if(!hasEvents) {
   $.ajax({
   url: global_base_url + 'feed/post_comment/' + id,
   type: 'POST',
   data: {
     comment: comment,
     csrf_test_name: global_hash,
     page: global_page,
     hide_prev: hide_prev
   },
   dataType: 'json',
   success: function(msg) {

     if (msg.error) {
       alert(msg.error_msg);
       return;
     }
     $('#feed-comments-spot-' + id).html(msg.content);
     $('#feed-comments-' + id).html(msg.comments);
   }
 });
}  

0 个答案:

没有答案