I have a little bug and i don't understand why
I have a form, people submit and i send data with Jquery.
But in input, when people send a link with params &id=data ... i receive in Mysql partial url
My Jquery code :
$(document).on('click', '.bouton', function(e) {
e.preventDefault();
var $this = $(this);
var categorie = $('#categorie').val();
var lien = $('#lien').val();
var titre = $('#titre').val();
var dataString5 = 'categorie='+ categorie + '&lien=' + lien + '&titre=' + titre;
$.ajax({
type: "POST",
url: "sendlien.php",
data: dataString5,
cache: false,
success: function(html){
Exemple in Input when people send :
I have in Mysql :
&id=5951454215454 is missed
Many thanks
It's (most likely) an encoding problem. You'd need to encode e.g. spaces (and all other "special" characters) properly ....or.... pass the parameters as an object/hashmap to jquery. It will handle the encoding automagically by default.
http://api.jquery.com/jquery.ajax/ says:
processData (default: true)
Type: Boolean
By default, data passed in to the data option as an object (technically, anything other than a string) will be processed and transformed into a query string, fitting to the default content-type "application/x-www-form-urlencoded". If you want to send a DOMDocument, or other non-processed data, set this option to false.
$.ajax({
type: "POST",
url: "sendlien.php",
data: {
"categorie": categorie,
"lien": lien,
"titre": titre
},
cache: false,