I've been searching but couldn't find how to add variables to my data
object.

I want to make an ajax requst with $.ajax, but before i do that, i
want to 'build'  the myDatavar.
That looks something like this:

-----------------------------------------------------------------------
var myDatavar = { name:'woutse', age:'91'} ;

var obj = document.getElementsByName('country');
for(i=0;i<obj.length;i++)
{
     if (obj[i].type=='text')
     {
                     if (obj[i].value!=obj[(i-1)].value)
             {
                              /// U can see what im trying to de here,
but this doesnt work
                 var t = { 'ctr['+obj[i].alt+'] tr' : obj[i].value };
                $.merge(myDatavar , t);
                    }
      }
}

        $.ajax({
          type: 'POST',
          url:'http://www.tinpay.nl/textadmin/save/',
          data: myDatavar,
          dataType: 'text',
          success: function(data) { refreshData();  },
          error: function () {  alert('error'); }
        });


So, how to add data to a object-variable?

thanks in advance,
woutse

Reply via email to