I need to remove all double quotes,single quotes using jQuery AJAX in with google language translator in PHP when i change onchange()
it does not translate the string or character if double quotes found. My code below:
HTML:
<select name="langid" id="langid<@=review_id@>" class="guest clearfix" style="width: 150px;height: 29px;" onchange='translate_text("<@=review_id@>","<@=review_title@>","<@=your_view@>","<@=neg_review@>");'>
</select>
JavaScript/jQuery:
function translate_text($review_id,$review_title,$your_view,$neg_review)
{
var sel = jQuery('#langid'+$review_id).val();
var url=serverurl+'index.php/feedback';
showLoadingBar();
if(sel == 0)
sel = 'en';
var passDataAsStr="opcode=translate_text&positivereview="+
$your_view+"&negativereview="+$neg_review+"&title="+$review_title+"&lang="+sel;
jQuery.ajax({
type: "POST",
url: url,
//async : false,
data: passDataAsStr,
success: function(response) {
hideLoadingBar();
// console.log(response);
jQuery('#btnclose'+$review_id).show();
jQuery('#trans_div'+$review_id).show();
var res = jQuery.parseJSON(response);
console.log(res['title']);
console.log(res['posrev']);
console.log(res['negrev']);
jQuery('#titleid_'+$review_id).text(res['title']);
jQuery('#positiveid'+$review_id).text(res['posrev']);
jQuery('#negativeid'+$review_id).text(res['negrev']);
}
});
}
When I want change the language translator it does not change
Suppose $review_title = "New "home" away from home when in village"
, it does not translate in another languages,because double quotes "home" at the middle of string
Any body having any idea please help to sort it out. Thanks