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 Quote Link to comment 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 Quote Link to comment 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); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.