Ok, this one is weird, i have this code:
$('#nps').submit(function(e) {
e.preventDefault();
var images = 'pic='+$('img[name="pic"]').attr('src');
var inputs = $(this).serialize();
$.ajax({
url: "pages/"+page+".php?"+inputs+'&'+images+'&action='+param,
cache: false
}).done(function( html ) {
update(html);
}).fail(function (){
window.location = "/";
});
});
What i’m trying to do is to pass to a php page some get parameters with the form inputs and the src of an image with the name pic.
The problam is that the pic param doesn’t get passed all of the time, one time it is and the other it’s not, randomally…
You are not properly encoding your request parameters. Make sure you url encode them using the
encodeURIComponentfunction:Now in your php script you will be able to use
$_GET['pic']and$_GET['action']and then$_POST['someFormElementName'](for the form elements).