Find Jobs
Hire Freelancers

Answer a quetsion -- 2

$10 USD

Completed
Posted about 9 years ago

$10 USD

Paid on delivery
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/[login to view URL]", 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="' + [login to view URL] + '" title="' + [login to view URL] + '">' + [login to view URL] + '</option>'); }) $('#ddl_users').on('change',function (data) { //alert('hi'); alert($(this).val()); $.each(data, function (index, item) { alert([login to view URL]); //if ($(this).val() == [login to view URL]) { // alert('match:' + $(this).val() + ': ' + [login to view URL]); //} }); }); }, error: function (data, status, jqXHR) { alert('There was an error loading User Data.'); } });
Project ID: 7436567

About the project

6 proposals
Remote project
Active 9 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
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 user object returned in ajax call. Then the user object can be accessed in on change handler for selected option $(this).find(option:selected).attr(data-user) and the rest of the form can be filled based on it. If you understand it implement on you own, no need to accept the bid. If you want, i can do it for you. Regards, Kasi
$10 USD in 1 day
4.9 (12 reviews)
4.2
4.2
6 freelancers are bidding on average $13 USD for this job
User Avatar
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 for your response.. thank you.. :)
$10 USD in 0 day
4.9 (152 reviews)
5.7
5.7
User Avatar
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. Thanks & Regards HarbourSpace
$15 USD in 1 day
5.0 (1 review)
2.9
2.9
User Avatar
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, etc. I am very confident about this job and I can manage stuff very well and make you smile. Thanks
$15 USD in 1 day
4.7 (5 reviews)
2.9
2.9
User Avatar
Hello, If you want to send the data as JSON, you have to encode it :)   Cheers,
$15 USD in 3 days
5.0 (3 reviews)
1.2
1.2
User Avatar
A proposal has not yet been provided
$10 USD in 0 day
0.0 (0 reviews)
0.0
0.0

About the client

Flag of UNITED STATES
Altamonte Springs, United States
4.9
19
Payment method verified
Member since Feb 17, 2008

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.