davelearning Posted January 13, 2011 Share Posted January 13, 2011 Hi All, I have the below: $("form#caption").submit(function() { var i_title = $('#i_title').attr('value'); var p_id = $('#p_id').attr('value'); var datastring = 'i_title='+ i_title +'& p_id='+ p_id; $.ajax({ type: "POST", url: "includes/captionupdate.php", data: datastring, success: function(){ $('form#caption').hide(function(){ $('div.success').fadeIn();}); window.location.reload(),5000; } }); return false; }); }); This works fine unless the i_title field contains an & symbol, in which case nothing is parsed after it, how do I go about correcting this? For instance if my i_title was Me & My Dog, the i_title would save as Me Link to comment https://forums.phpfreaks.com/topic/224279-symbol-problems/ Share on other sites More sharing options...
davelearning Posted January 13, 2011 Author Share Posted January 13, 2011 After 4 hours searching on the web, I have come across htmlentities, which I guess is what I need to implement, however it doesnt amtter how many times I read examples I just dont get it, how would I implement in my case? Thanks Link to comment https://forums.phpfreaks.com/topic/224279-symbol-problems/#findComment-1158907 Share on other sites More sharing options...
davelearning Posted January 14, 2011 Author Share Posted January 14, 2011 var datastring = 'i_title='+ encodeURIComponent(i_title) +'&p_id='+ encodeURIComponent(p_id); Link to comment https://forums.phpfreaks.com/topic/224279-symbol-problems/#findComment-1159299 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.