无法解析属性中的json数据。
<a href="" data-msg="{"countryName":"Afghanistan","cityName":"Eshkashem","supplierType":"RESTURENT","ProductType":"Lunch","SupplierName":"amuls","supplierTypeName":"RESTURENT","products":{"productName":"ckTestt","productCode":"QB8ZWUOF","productDescription":"<p ><b>Nandamuri Taraka Rama Rao<\/b>&nbsp;(28 May 1923<sup class="reference" id="cite_ref-TheHindu_DOB_1-1" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-TheHindu_DOB-1" >[ ]<\/a><\/sup>&nbsp;&ndash; 18 January 1996), popularly known as&nbsp;<b>NTR<\/b>, was an Indian actor, producer, director, editor and politician who served as&nbsp;<a href="https:\/\/en.wikipedia.org\/wiki\/List_of_Chief_Ministers_of_Andhra_Pradesh" title "List of Chief Ministers of Andhra Pradesh">Chief Minister of Andhra Pradesh<\/a>&nbsp;for seven years over three terms. NTR received three&nbsp;<a class="mw-redirect" href="https:\/\/en.wikipedia.org\/wiki\/National_Film_Awards_(India)" title "National Film Awards (India)">National Film Awards<\/a>&nbsp;for co-producing&nbsp;<i><a class="mw-redirect" href="https:\/\/en.wikipedia.org\/wiki\/Thodu_Dongalu_(1954_film)" title "Thodu Dongalu (1954 film)">Thodu Dongalu<\/a><\/i>&nbsp;(1954) and&nbsp;<i><a class="mw-redirect" href="https:\/\/en.wikipedia.org\/wiki\/Seetharama_Kalyanam" title "Seetharama Kalyanam">Seetharama Kalyanam<\/a><\/i>&nbsp;(1960) under&nbsp;<a href="https:\/\/en.wikipedia.org\/wiki\/N._Trivikrama_Rao" title "N. Trivikrama Rao">National Art Theater, Madras<\/a>,<sup class="reference" id="cite_ref-3" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-3" >[ ]<\/a><\/sup>&nbsp;and directing&nbsp;<i><a href="https:\/\/en.wikipedia.org\/wiki\/Varakatnam" title "Varakatnam">Varakatnam<\/a><\/i>&nbsp;(1970),<sup class="reference" id="cite_ref-2ndawardPDF_4-0" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-2ndawardPDF-4" >[ ]<\/a><\/sup>&nbsp;NTR has received the erstwhile&nbsp;<a href="https:\/\/en.wikipedia.org\/wiki\/Rashtrapati_Award" title "Rashtrapati Award">Rashtrapati Awards<\/a>&nbsp;for his performance(s) in the films&nbsp;<i><a href="https:\/\/en.wikipedia.org\/wiki\/Raju_Peda" title "Raju Peda">Raju Peda<\/a><\/i>&nbsp;(1954) and&nbsp;<i><a href="https:\/\/en.wikipedia.org\/wiki\/Lava_Kusa" title "Lava Kusa">Lava Kusa<\/a><\/i>&nbsp;(1963).<sup class="reference" id="cite_ref-Times_of_India_Press_5-0" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-Times_of_India_Press-5" >[ ]<\/a><\/sup><sup class="reference" id="cite_ref-RAJU-PEDA_1954_6-0" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-RAJU-PEDA_1954-6" >[ ]<\/a><\/sup><sup class="reference" id="cite_ref-Ramachandran_1973_7-0" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-Ramachandran_1973-7" >[ ]<\/a><\/sup>&nbsp;He garnered the&nbsp;<a href="https:\/\/en.wikipedia.org\/wiki\/Nandi_Award_for_Best_Actor" title "Nandi Award for Best Actor">Nandi Award for Best Actor<\/a>&nbsp;for&nbsp;<i><a href="https:\/\/en.wikipedia.org\/wiki\/Kodalu_Diddina_Kapuram" title "Kodalu Diddina Kapuram">Kodalu Diddina Kapuram<\/a><\/i>&nbsp;in 1970, and the Inaugural&nbsp;<a href="https:\/\/en.wikipedia.org\/wiki\/Filmfare_Award_for_Best_Actor_–_Telugu" title "Filmfare Award for Best Actor – Telugu">Filmfare Award for Best Actor &ndash; Telugu<\/a>&nbsp;in 1972 for&nbsp;<i><a href="https:\/\/en.wikipedia.org\/wiki\/Badi_Panthulu" title "Badi Panthulu">Badi Panthulu<\/a><\/i>.<sup class="reference" id="cite_ref-Times_of_India_Press_5-1" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-Times_of_India_Press-5" >[ ]<\/a><\/sup><sup class="reference" id="cite_ref-Ramachandran_1973_7-1" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-Ramachandran_1973-7" >[ ]<\/a><\/sup><sup class="reference" id="cite_ref-Ramachandran_1973_7-2" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-Ramachandran_1973-7" >[ ]<\/a><\/sup><sup class="reference" id="cite_ref-8" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-8" >[8]<\/a><\/sup><\/p>\n\n <p >NTR made his debut as an actor in a&nbsp;<a href="https:\/\/en.wikipedia.org\/wiki\/Telugu_cinema" title "Telugu cinema">Telugu<\/a>&nbsp;social film&nbsp;<i><a href="https:\/\/en.wikipedia.org\/wiki\/Mana_Desam" title "Mana Desam">Mana Desam<\/a><\/i>, directed by&nbsp;<a href="https:\/\/en.wikipedia.org\/wiki\/L._V._Prasad" title "L. V. Prasad">L. V. Prasad<\/a>&nbsp;in 1949. He gained popularity in the 1950s when he became well known for his portrayals of&nbsp;<a href="https:\/\/en.wikipedia.org\/wiki\/Hindu" title "Hindu">Hindu<\/a>&nbsp;deities, especially&nbsp;<a href="https:\/\/en.wikipedia.org\/wiki\/Krishna" title "Krishna">Krishna<\/a>&nbsp;and&nbsp;<a href="https:\/\/en.wikipedia.org\/wiki\/Rama" title "Rama">Rama<\/a>,<sup class="reference" id="cite_ref-I96_9-0" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-I96-9" >[ ]<\/a><\/sup>&nbsp;roles which have made him a &quot;messiah of the masses&quot;.<sup class="reference" id="cite_ref-10" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-10" >[ 0]<\/a><\/sup>&nbsp;He later became known for portraying antagonistic characters and&nbsp;<a href="https:\/\/en.wikipedia.org\/wiki\/Robin_Hood" title "Robin Hood">Robin Hood<\/a>-esque hero characters in films. In total, he starred in 300 films, and has become one of the most prominent figures in the history of Telugu cinema.<sup class="reference" id="cite_ref-autogenerated3_11-0" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-autogenerated3-11" >[ 1]<\/a><\/sup><sup class="reference" id="cite_ref-12" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-12" >[ 2]<\/a><\/sup><sup class="reference" id="cite_ref-Sashidhar_AS,_TNN_13_Aug_2012,_04.15PM_IST_13-0" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-Sashidhar_AS,_TNN_13_Aug_2012,_04.15PM_IST-13" >[ 3]<\/a><\/sup><sup class="reference" id="cite_ref-14" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-14" >[ 4]<\/a><\/sup>&nbsp;He was voted &quot;Greatest Indian Actor of All Time&quot; in a&nbsp;<a class="mw-redirect" href="https:\/\/en.wikipedia.org\/wiki\/CNN-IBN" title "CNN-IBN">CNN-IBN<\/a>&nbsp;national poll conducted in 2013 on the occasion of the Centenary of Indian Cinema.<sup class="reference" id="cite_ref-15" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-15" >[ 5]<\/a><\/sup><sup class="reference" id="cite_ref-16" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-16" >[ 6]<\/a><\/sup><sup class="reference" id="cite_ref-17" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-17" >[ 7]<\/a><\/sup><sup class="reference" id="cite_ref-18" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-18" >[18]<\/a><\/sup><\/p>\n","productImage":"http:\/\/localhost\/nugds2.0\/assets\/mealsvoucher\/1930b4e48525b4f90add0d80d09ba7ff.jpg","productPdfFile":"","productPrice":23,"apiPrice":"23","discountPrice":2,"apiDiscountPrice":"2","commissionPrice":0,"apiCommissionPrice":0,"productCurrency":"SGD","productValidFrom":"2018-02-28","productValidTo":"2018-02-28","voucherValidTo":"2018-02-28","termsAndConditions":"<p ><b>Nandamuri Taraka Rama Rao<\/b>&nbsp;(28 May 1923<sup class="reference" id="cite_ref-TheHindu_DOB_1-1" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-TheHindu_DOB-1" >[ ]<\/a><\/sup>&nbsp;&ndash; 18 January 1996), popularly known as&nbsp;<b>NTR<\/b>, was an Indian actor, producer, director, editor and politician who served as&nbsp;<a href="https:\/\/en.wikipedia.org\/wiki\/List_of_Chief_Ministers_of_Andhra_Pradesh" title "List of Chief Ministers of Andhra Pradesh">Chief Minister of Andhra Pradesh<\/a>&nbsp;for seven years over three terms. NTR received three&nbsp;<a class="mw-redirect" href="https:\/\/en.wikipedia.org\/wiki\/National_Film_Awards_(India)" title "National Film Awards (India)">National Film Awards<\/a>&nbsp;for co-producing&nbsp;<i><a class="mw-redirect" href="https:\/\/en.wikipedia.org\/wiki\/Thodu_Dongalu_(1954_film)" title "Thodu Dongalu (1954 film)">Thodu Dongalu<\/a><\/i>&nbsp;(1954) and&nbsp;<i><a class="mw-redirect" href="https:\/\/en.wikipedia.org\/wiki\/Seetharama_Kalyanam" title "Seetharama Kalyanam">Seetharama Kalyanam<\/a><\/i>&nbsp;(1960) under&nbsp;<a href="https:\/\/en.wikipedia.org\/wiki\/N._Trivikrama_Rao" title "N. Trivikrama Rao">National Art Theater, Madras<\/a>,<sup class="reference" id="cite_ref-3" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-3" >[ ]<\/a><\/sup>&nbsp;and directing&nbsp;<i><a href="https:\/\/en.wikipedia.org\/wiki\/Varakatnam" title "Varakatnam">Varakatnam<\/a><\/i>&nbsp;(1970),<sup class="reference" id="cite_ref-2ndawardPDF_4-0" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-2ndawardPDF-4" >[ ]<\/a><\/sup>&nbsp;NTR has received the erstwhile&nbsp;<a href="https:\/\/en.wikipedia.org\/wiki\/Rashtrapati_Award" title "Rashtrapati Award">Rashtrapati Awards<\/a>&nbsp;for his performance(s) in the films&nbsp;<i><a href="https:\/\/en.wikipedia.org\/wiki\/Raju_Peda" title "Raju Peda">Raju Peda<\/a><\/i>&nbsp;(1954) and&nbsp;<i><a href="https:\/\/en.wikipedia.org\/wiki\/Lava_Kusa" title "Lava Kusa">Lava Kusa<\/a><\/i>&nbsp;(1963).<sup class="reference" id="cite_ref-Times_of_India_Press_5-0" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-Times_of_India_Press-5" >[ ]<\/a><\/sup><sup class="reference" id="cite_ref-RAJU-PEDA_1954_6-0" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-RAJU-PEDA_1954-6" >[ ]<\/a><\/sup><sup class="reference" id="cite_ref-Ramachandran_1973_7-0" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-Ramachandran_1973-7" >[ ]<\/a><\/sup>&nbsp;He garnered the&nbsp;<a href="https:\/\/en.wikipedia.org\/wiki\/Nandi_Award_for_Best_Actor" title "Nandi Award for Best Actor">Nandi Award for Best Actor<\/a>&nbsp;for&nbsp;<i><a href="https:\/\/en.wikipedia.org\/wiki\/Kodalu_Diddina_Kapuram" title "Kodalu Diddina Kapuram">Kodalu Diddina Kapuram<\/a><\/i>&nbsp;in 1970, and the Inaugural&nbsp;<a href="https:\/\/en.wikipedia.org\/wiki\/Filmfare_Award_for_Best_Actor_–_Telugu" title "Filmfare Award for Best Actor – Telugu">Filmfare Award for Best Actor &ndash; Telugu<\/a>&nbsp;in 1972 for&nbsp;<i><a href="https:\/\/en.wikipedia.org\/wiki\/Badi_Panthulu" title "Badi Panthulu">Badi Panthulu<\/a><\/i>.<sup class="reference" id="cite_ref-Times_of_India_Press_5-1" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-Times_of_India_Press-5" >[ ]<\/a><\/sup><sup class="reference" id="cite_ref-Ramachandran_1973_7-1" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-Ramachandran_1973-7" >[ ]<\/a><\/sup><sup class="reference" id="cite_ref-Ramachandran_1973_7-2" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-Ramachandran_1973-7" >[ ]<\/a><\/sup><sup class="reference" id="cite_ref-8" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-8" >[8]<\/a><\/sup><\/p>\n\n <p >NTR made his debut as an actor in a&nbsp;<a href="https:\/\/en.wikipedia.org\/wiki\/Telugu_cinema" title "Telugu cinema">Telugu<\/a>&nbsp;social film&nbsp;<i><a href="https:\/\/en.wikipedia.org\/wiki\/Mana_Desam" title "Mana Desam">Mana Desam<\/a><\/i>, directed by&nbsp;<a href="https:\/\/en.wikipedia.org\/wiki\/L._V._Prasad" title "L. V. Prasad">L. V. Prasad<\/a>&nbsp;in 1949. He gained popularity in the 1950s when he became well known for his portrayals of&nbsp;<a href="https:\/\/en.wikipedia.org\/wiki\/Hindu" title "Hindu">Hindu<\/a>&nbsp;deities, especially&nbsp;<a href="https:\/\/en.wikipedia.org\/wiki\/Krishna" title "Krishna">Krishna<\/a>&nbsp;and&nbsp;<a href="https:\/\/en.wikipedia.org\/wiki\/Rama" title "Rama">Rama<\/a>,<sup class="reference" id="cite_ref-I96_9-0" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-I96-9" >[ ]<\/a><\/sup>&nbsp;roles which have made him a &quot;messiah of the masses&quot;.<sup class="reference" id="cite_ref-10" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-10" >[ 0]<\/a><\/sup>&nbsp;He later became known for portraying antagonistic characters and&nbsp;<a href="https:\/\/en.wikipedia.org\/wiki\/Robin_Hood" title "Robin Hood">Robin Hood<\/a>-esque hero characters in films. In total, he starred in 300 films, and has become one of the most prominent figures in the history of Telugu cinema.<sup class="reference" id="cite_ref-autogenerated3_11-0" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-autogenerated3-11" >[ 1]<\/a><\/sup><sup class="reference" id="cite_ref-12" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-12" >[ 2]<\/a><\/sup><sup class="reference" id="cite_ref-Sashidhar_AS,_TNN_13_Aug_2012,_04.15PM_IST_13-0" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-Sashidhar_AS,_TNN_13_Aug_2012,_04.15PM_IST-13" >[ 3]<\/a><\/sup><sup class="reference" id="cite_ref-14" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-14" >[ 4]<\/a><\/sup>&nbsp;He was voted &quot;Greatest Indian Actor of All Time&quot; in a&nbsp;<a class="mw-redirect" href="https:\/\/en.wikipedia.org\/wiki\/CNN-IBN" title "CNN-IBN">CNN-IBN<\/a>&nbsp;national poll conducted in 2013 on the occasion of the Centenary of Indian Cinema.<sup class="reference" id="cite_ref-15" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-15" >[ 5]<\/a><\/sup><sup class="reference" id="cite_ref-16" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-16" >[ 6]<\/a><\/sup><sup class="reference" id="cite_ref-17" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-17" >[ 7]<\/a><\/sup><sup class="reference" id="cite_ref-18" ><a href="https:\/\/en.wikipedia.org\/wiki\/N._T._Rama_Rao#cite_note-18" >[18]<\/a><\/sup><\/p>\n","availableQuantity":"23","stockIn":"23","createdBy":"39","productId":"86","countryId":"1","cityId":"5909","supplierTypeId":"4","supplierId":"6","productTypeId":"5","productStatus":"A","productapprovalStatus":"N","redemptionStartFrom":"2018-02-27","appointmentreq":"I","limitTo":"Male & Female","ownCommission":"3","createdDate":"2018-02-27","ApprovalStatus":"N"},"Branch":{"branchId":"16","branchName":"hhhhhhhhv","branchAddress":"hhhhhhhh","contactPerson":"hhhhhhhh","landmark":"hhhhhhhh","latitude":"13.0827","longitude":"80.2707","operatingHours":"hhhhhhhh-hhhhhhhh","howToGetThere":"hhhhhhhh","isdCode":"+65","contactNumber":"77777777"},"PriceRange":[],"productImages":["http:\/\/localhost\/nugds2.0\/assets\/mealsvoucher\/29e7e26d5e50543148c3a89b8cf7652e.jpg","http:\/\/localhost\/nugds2.0\/assets\/mealsvoucher\/29e7e26d5e50543148c3a89b8cf7652e.jpg","http:\/\/localhost\/nugds2.0\/assets\/mealsvoucher\/29e7e26d5e50543148c3a89b8cf7652e.jpg","http:\/\/localhost\/nugds2.0\/assets\/mealsvoucher\/29e7e26d5e50543148c3a89b8cf7652e.jpg","http:\/\/localhost\/nugds2.0\/assets\/mealsvoucher\/bfc8afaed57fa949f1ca4d13f9b0472c.jpg","http:\/\/localhost\/nugds2.0\/assets\/mealsvoucher\/a4a3c8cfa5b569a371593b018110d755.jpg","http:\/\/localhost\/nugds2.0\/assets\/mealsvoucher\/6dc9a99e7ff7cc1ded508a630d9e0e07.jpeg"]}" id="productNameEdit">Edit</a>
我尝试过两种方式
在此无法获取值
$(document).on('click','#productNameEdit',function(e){
var finalData = JSON.stringify($(this).attr("data-msg").replace(/\\/g, ""));
console.log(finalData);
var productDetails = JSON.parse(finalData);
alert(finalData.countryName );
});
如果json内容不正确无法获取值,则能够获取数据
$(document).on('click','#productNameEdit',function(e){
var productDetails = JSON.parse(tjq(this).attr("data-msg"));
alert(productDetails.countryName );
});
我做错了什么以及如何过来。
帮助我解析原始json中的任何更改数据。我试过两种方式仍然没有运气