Updating User Profile Field REST Endpoint

How do you update the user profile field REST endpoint with a name and value for a Single Select? This is what I currently have:

_saveCountry = function(context) {
	return $.telligent.evolution.put({
	    url: jQuery.telligent.evolution.site.getBaseUrl() + 'api.ashx/v2/userprofilefields/country.json',
	    data: { 
		    'name':  context.countryname,
		    'value': context.country
	    },
	    success: function(response) {

	    }
    });
		     
},

Parents Reply
  • Actually, I don't want to update it in a loop as previously stated. I want to update it with the name and value of the Country select box each time a user fills out and submits the form. 

    The problem is that my code is overwriting the previously saved name and value with the current one, instead of adding to it. Here is the code that is called each time a user submits the form:

    _saveCountry = function(context) {
        var data = {};   
        var countryName = $("select.country").children("option:selected").text();
        var iso2 =  $(context.country).val();
        var country = '_FieldTypeChoices_' + iso2;
        data[country] = countryName;
    	return $.telligent.evolution.put({
    	    url: jQuery.telligent.evolution.site.getBaseUrl() + 'api.ashx/v2/userprofilefields/Country.json',
    	    data: data
        }); 
    		     
    },

Children