jQuery: how to refresh javascript value on select event?

I have such code:

var regions = [{'label': 'array', 'value': '1'}];   //default values

$("#auto1").select({
    regions = jQuery.parseJSON(     //updating process
        $.ajax({
            type: 'POST',
            url: '/ajax/place/',
            data: { country: value }
        })
    );
    return false;
});

$("#auto2").some_func({
    initialValues: regions,     //here must be updated values, but it's not
});

I think it is understandable from above code: when page loaded, element #auto2 has default values, but when I select smth from #auto1 it must be updated, but it's not.

How can I update the values corresponding to data value.

Thanks!

Answers


$("#auto1").select({
    regions = jQuery.parseJSON(     //updating process
        $.ajax({
            type: 'POST',
            url: '/ajax/place/',
            data: { country: value },
            success: function( data ) {
               //trying yo update values, after successfull response
               //some cool code is here or calling a function to update values
            },
            error: function( data ) {
               //error to update
            }
         }
        })
    );
    return false;
}); 

Need Your Help

Error Deploying Java App on OpenShift Express

deployment cloud openshift

I am attempting to deploy my java app to OpenShift Express.

Android wait() not working

android multithreading handler wait

This is my first question here, so please forgive me if I disobeyed any of the forum rules.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.