Hi Dave,
Use a regular expression to split your form element names like this: var regex = /^(\w+)\[(\w+)\]\[(\w+)\]$/i; var str = "data[User][username]"; var matches = regex.exec(str); // matches[2] now contains "user" Dave Maharaj :: WidePixels.com wrote: > > > Hoping for some simple help here. > > I have this structure in my forms > > name="data[User][username]" > > But depending on the form it the ['User'] section will change throught the > site. How can I pull the User as a variable? > > The script has something like this: > > $.post('/ajax_validate/users/', { > field: fieldName, > value: fieldValue > }, > > Where I want to add the variable like > > $.post('/ajax_validate/'+myVarHere, { > field: fieldName, > value: fieldValue > }, > > Thanks, > > Dave > > > -- View this message in context: http://www.nabble.com/Help-with-getting-variable-tp25429729s27240p25451239.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.