Answer a quetsion -- 2

Ukończone Opublikowano Apr 6, 2015 Płatność przy odbiorze
Ukończone Płatność przy odbiorze

I make an ajax call to populate a select

This works:

I want to then populate the rest of the form with data that was returned from the ajax call

I tried this but the data object is undefined. How do I pass the data object into the change event

$.ajax({

url: "/_handlers/[url removed, login to view]",

data: {userRole_ID: 1300},

dataType: 'json',

type: 'POST',

contentType: 'application/x-www-form-urlencoded',

success: function (data) {

$('#ddl_users').html('<option value="0" title="Add a new client user"> Add New</option> ');

$.each(data, function (index, item) {

$('#ddl_users').append('<option value="'

+ [url removed, login to view]

+ '" title="'

+ [url removed, login to view]

+ '">'

+ [url removed, login to view]

+ '</option>');

})

$('#ddl_users').on('change',function (data) {

//alert('hi');

alert($(this).val());

$.each(data, function (index, item) {

alert([url removed, login to view]);

//if ($(this).val() == [url removed, login to view]) {

// alert('match:' + $(this).val() + ': ' + [url removed, login to view]);

//}

});

});

},

error: function (data, status, jqXHR) {

alert('There was an error loading User Data.');

}

});

HTML jQuery / Prototype

Numer ID Projektu: #7436567

O projekcie

6 ofert Zdalny projekt Aktywny Apr 6, 2015

Przyznany użytkownikowi:

kasianand

Hi, The on change handler will contain the dropdown object as first parameter. It won't contain the data object. My suggestion would be while creating option, create an data attribute which contains the whole u Więcej

$10 USD w 1 dzień
(12 ocen)
4.2

6 freelancerów złożyło ofertę za $13 w tym projekcie

devikagupta

hello sir, i can do your project.... please accept my bid so that i can start it... i m expert in this type of project... u can also see my portfolio... please sir accept my bid.. please hope u will do i m waiting f Więcej

$10 USD w ciągu 0 dni
(152 Oceny)
5.7
harbourspace

Hello Sir/Mam, I have 5 years of experience in the field of web development and designing. I can assure you that your work will be done in given time and in full professional way. Awaiting your positive response Więcej

$15 USD w ciągu 1 dnia
(1 Ocena)
2.9
dataentry17

Hello Friend I have read your project very carefully and I understand what you want. thanks for good and clear explanation I have almost done many work like this. I have very good hold on HTML, PHP, MYSQL, Jquery, Więcej

$15 USD w ciągu 1 dnia
(5 Oceny)
2.9
gnouv

Hello, If you want to send the data as JSON, you have to encode it :)   Cheers,

$15 USD w ciągu 3 dni
(3 Oceny)
1.2
dejanofreelance

A proposal has not yet been provided

$10 USD w ciągu 0 dni
(0 Oceny)
0.0