I have been trying for hours now and cant work out what im doing wrong im sure that its something simple im missing but any help would be great.
I have created an object which is dynamically populated, this works perfectly the problem comes when im trying to send the data over to a php process page via ajax.
The code below is my loop for the object to get the key and value.
//build up dynamic datastring for ajax
            var dataString = ""
            dataString += "{";
            jQuery.each(obj,function(key, value) {
                dataString += "'"+key+"':'"+value+"',";
            });
            //remove last , then add the containing bracket
            dataString = dataString.slice(0,-1);
            dataString += "};";
            console.log(dataString);
                //do ajax
                jQuery.ajax({
                    url:'/builder/process-form.php',
                    type:'POST',
                    data:dataString
                }).done(function(data){
                    console.log(data);
                });
            });
I have wrote the dataString var to the console and this is the output {'type':'tickbox','fname':'Empty','value':'Empty','req':'Yes','valType':''}; This looks properly structured for the data parameter?
On the php page i loop through all post data and this is displaying noting, if i copy {'type':'tickbox','fname':'Empty','value':'Empty','req':'Yes','valType':''}; after the data: line then this works?
Any help would be greatly appreciated
Many thanks
Ian
 
     
     
    