Passing POST data from Javascript(jquery) to php problems? -


i been trying passing value:

// content submit php others string here. , link: http://www.youtube.com/watch?v=cuugkj2i1xc&feature=rec-lgout-exp_fresh+div-1r-2-hm 

to php page, , insert database. here current code:

... // javascript  var content = $("#mcontent").val(); $.ajax({     url : '<?php echo path; ?>functions/save.php',     type: 'post',     data: 'id=<?php echo $_get['id']; ?>&content=' + content + '&action=save&val=<?php echo md5("secr3t" . $_session['userid_id']); ?>',     datatype: 'json',      success: function(response) {         if (response.status == 'success') {             alert(response.message);         } else {             alert(response.message);         }     } }); 

no errors actually, in database, saved is:

others string here. , link: http://www.youtube.com/watch?v=cuugkj2i1xc 

i guess know whats problem, problem the:

http://www.youtube.com/watch?v=cuugkj2i1xc&feature=rec-lgout-exp_fresh+div-1r-2-hm

i think takes "&feature=" post data. have tried:

but both not work. have others way?

edit:

do foresee others problem might occurs? content type/write user. meaning that, user can type/write anything. on backhand, did others checking though, including "mysql_real_escape_string"

a nice thing jquery data parameter can take js object, don't need try build query string manually.

<?php      $data = array("id" => $_get['id'],                    "action" => "save",                    "val" => md5("secr3t",$_session['userid_id'])                  );     $json_data = encode_json($data);     $json_data = str_ireplace($json_data, '</script>', '<\/script>');     echo "var data = $json_data;"; ?> data.content = content; $.ajax({             url : '<?php echo path; ?>functions/save.php',             type: 'post',             data: data,             datatype: 'json', 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -