tags:

views:

23

answers:

1

Hi! Trying to send array + vars with Ajax, Sending just the array worked fine...but when trying to add the vars i get empty in response.

var ar = $("select#galaddvenn").serialize();
    var kat = $('input[name=kat]').val();
    var bppuid = $('input[name=bppuid]').val();
    j.ajax({
    data: ({'ar':ar,'kat':kat,'bppuid':bppuid}), //test normal mode..array works with: data: ar, 
    dataType: "html",
+1  A: 

.serialize() returns a POST-string, in the form of a=1&b=2&c=3&d=4&e=5, so try the following instead:

var ar = $("select#galaddvenn").serialize();
var kat = $('input[name=kat]').val();
var bppuid = $('input[name=bppuid]').val();

ar += '&kat=' + kat;
ar += '&bppuid=' + bppuid;

j.ajax({
 data: ar,
 dataType: "html",

[...]
softcr
Thanks alot! Worked like a charm :)
Thundercat