I’ve been doing some research to find a solution to use $.ajax with JSON that can handle character encoding issues. Looking through past posts I’ve seen notes about contentType and other suggestions I’ve incorporated.
Long story short, an entry like “Bobs Resume” works in vanity_name, but “Bob’s Resume” doesn’t.
Wondering if there is something else I’m missing?
var myData = {
resume_id : '<?php echo $this->session->userdata('resume_id'); ?>',
vanity_name: $('#vanity_name').val()
}
$.ajax({
type : 'POST',
url : '<?php echo site_url('resume/change_vanity_name'); ?>',
contentType : "application/x-www-form-urlencoded; charset=iso-8859-1",
data: myData,
dataType: "html",
success : function(msg){
$('#vanity_name_session').text($('#vanity_name').val());
},
error: function(){
alert('failure');
}
});
});
encodeURIComponent should do the trick. –
EDITED correct answer
use