English 中文(简体)
j Query post() tratrophe如何自动转换成html数字实体?
原标题:jQuery post() apostrophe how is apostrophe automatically converted to html numeric entity?

如下文所示,我将一些数据张贴到服务器上。 当我收到服务器方面的员额数据时,我惊讶地看到,员额变量已经变成了单一外向数字(即改为<代码>&第39号;)。 如何做到这一点? Jquery.post()是否进行了转换? 我找不到这方面的文件。

$("#save").click(function(event) {
    event.preventDefault();

    var postdata = "id="+id+"&note="+$("#note").val();

    $.post("save_note.php", postdata, function(data){
    $( #save_status ).text(data);
    });
});
最佳回答

它发生在网络浏览器上。

核对<代码>$(“#note”).val()——在封面下记住,当你以某种形式将某种东西插入超文本的OM。

问题回答

这根本没有发生。

可能的原因是,这一数值在你读到该数值之前就已编码为超文本,并将其列入数据表。

您可以:

  • encodeURIComponent
  • http://api.jquery.com/serialize/“rel=“nofollow” 表格方法,如:

    $("#save").click(function(event) {
      event.preventDefault();
    
      var $form = $(event.target).closest( form );
      //var postdata = "id="+id+"&note="+$("#note").val();
    
      $.post($form.attr( method ), $form.serialize(), function(data){
      $( #save_status ).text(data);
      });
    });
    

我希望这一帮助。





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签