jjzjj

php - 使用 jQuery (ajax) 和 PHP 插入我的数据库

我正在尝试在我的表中插入一些数据:golden-book。一切都很好,我没有任何错误,答案很好,但我的表中没有数据插入。我不知道这段代码有什么问题,也许你能帮我?我在golden-book.js中的ajax请求functioninsert_messages(auteur_message,message){$.ajax({type:"POST",cache:false,url:"insert-messages.php",data:{auteur_message:auteur_message,message:message},success:function(){},error:funct

mongodb - 处理mongodb中的重音字符

我一直在努力寻找一种理想的方式来处理重音字符。首先,我在mongo中插入(获取)之前使用这两种方法对文本进行编码(解码)。functionencode_utf8(s){returnunescape(encodeURIComponent(s));}functiondecode_utf8(s){returndecodeURIComponent(unescape(s));}当我从mongodb获取评论并显示它们(ajax请求)时,此方法工作正常:$.ajax({url:"http:www.mywebsite.com/comments",type:"get",data:"key="+env.k