本文介绍了为什么字符串值会自动转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为Capacit'e Infraprojects Limited的公司名称



但是在服务器端我点击的名称公司



撇号转换为另一个值



示例 - Capacit'e Infraprojects Limited转换为Capacit& ;#39; e Infraprojects Limited



我尝试过:



 function GetSelectedOfferData(){
debugger;
var companyName = $(#single-appendSpeaker)。val();
if(companyName ==All){
$ .ajax({
type:POST,
dataType:json,
url: / OfferDocument / getAllOfferDocument,
data:{},
success:function(result){
var doc ='';


$。每个(结果,函数(i,val){
doc = doc +'< li>< a onclick =setOfferDocument(\''+ val.companyName +'\')class = link-downloadhref =javascript:void(0)>'+ val.companyName +'< / a>< br />< / li>'
});
$(#ProspectUL)。empty();
$(#ProspectUL)。append(doc);
}
});
}
解决方案




I have a company name called- Capacit'e Infraprojects Limited

But At server side when i Click on the Name of the company

the apostrophe is Convertred to another value

Example - Capacit'e Infraprojects Limited Converts to Capacit&#39;e Infraprojects Limited

What I have tried:

function GetSelectedOfferData() {
       debugger;
       var companyName = $("#single-appendSpeaker").val();
       if (companyName == "All") {
           $.ajax({
               type: "POST",
               dataType: "json",
               url: "/OfferDocument/getAllOfferDocument",
               data: {},
               success: function (result) {
                   var doc = '';


                   $.each(result, function (i, val) {
                       doc = doc + '<li><a onclick="setOfferDocument(\'' + val.companyName + '\')"  class="link-download" href="javascript:void(0)" >' + val.companyName + '</a><br /></li>'
                   });
                   $("#ProspectUL").empty();
                   $("#ProspectUL").append(doc);
               }
           });
       }
解决方案




这篇关于为什么字符串值会自动转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 04:38