-1

I am trying to add special characters into database with JavaScript using encodeURIComponent but it works in localhost and in server adding ' an extra / is also added infront of ' .

How to prevent this?


This is what I have so far:

var qn_text = encodeURIComponent($('#question_text').val()); 

question_text is the field ID.

$.ajax({ type: "POST", url: "<?= site_url('admin/inputdata')?>", 
                       data: "qn_text ="+qn_text, 
                       success: function(msg) { } 
      });

admin is my controller and then to model. If I enter special character like +'&, all these characters are entered in local database correctly. But at server side the characters like ' entered but an extra / is appended infront of ' .

4

1 に答える 1

2

サーバーで無効にする必要がありmagic_quotesます。PHPマニュアルのマジッククォートの無効化を参照してください。

于 2011-05-18T09:51:05.603 に答える