Loading...
Copy code
Close
Permalink
Close
Please tell us why you want to mark the subject as inappropriate.
(Maximum 200 characters)
Report Inappropriate
Cancel
Private Message
From :
guest
To :
Subject :
Content :
Type the characters you see in the picture below.
Send
Cancel
From :
guest
To :
Subject :
Content :
Type the characters you see in the picture below.
Send
Update
Cancel
Feedback
Email ID
Subject :
Comments :
Send
Cancel
Private Message
Type the characters you see in the picture below.
Type the characters you see in the picture below.
Attach files
Desktop
Google Docs
Each Attachment size should not exceed 1.0 MB.
Max no of attachments : 3
Loading User Profile...
guest
Response title
This is preview!
Attachments
Publish
Back to edit
Cancel
(
)
Sign In
New to this Portal? Click here to
Sign up
You can also use the below options to login
Login with Facebook
Login with Google
Login with Yahoo
jQuery
Plugins
UI
Meetups
Forum
Blog
About
Donate
All Forums
Recent Posts
Log In
Search
jQuery
Search
jQuery Forum
Move this topic
Forum :
Getting Started
Using jQuery
Using jQuery Plugins
Using jQuery UI
Developing jQuery Core
Developing jQuery Plugins
Developing jQuery UI
QUnit and Testing
About the jQuery Forum
jQuery Conferences
jQuery Mobile
Developing jQuery Mobile
Sub forum :
Move this topic
Cancel
Using jQuery
kayut
Building a form with JSON and Ajax
in
Using jQuery
•
5 years ago
Hi,
Looking at this example, I managed to create a drop-down menu which gets its content from a JSON file:
Building a from using JSON
However, I'm sure there is a better way to achieve this.
Could you please show me how would you solve this?
Thank you
1
Replies(12)
jakecigar
Re: Building a form with JSON and Ajax
5 years ago
How is that a form?
Why do you bother with <select>s? it would be more natural as <a>s. And less clicking.
JΛ̊KE
Leave a comment on jakecigar's reply
kayut
Re: Building a form with JSON and Ajax
5 years ago
You are right. It's not a form. I meant building a drop-down menu.
But this is not important. Important is the way I wrote the JavaScript.
I want to know what would be the better code for achieving the same result.
Leave a comment on kayut's reply
jakecigar
Re: Building a form with JSON and Ajax
5 years ago
A <select> should use a change event. But your select has nothing to change to. Which is why I suggest you don't use a <select>.
JΛ̊KE
Leave a comment on jakecigar's reply
kayut
Re: Building a form with JSON and Ajax
5 years ago
But I'm trying to learn how to create dynamically a drop-down by using JSON data.
I don't want to use anything but a select. :-) Even if it doesn't make sense.
Leave a comment on kayut's reply
jakecigar
Re: Building a form with JSON and Ajax
5 years ago
Use more than one option, and use the change event. A FAQ is not a good use of a <select>.
JΛ̊KE
Leave a comment on jakecigar's reply
kayut
Re: Building a form with JSON and Ajax
5 years ago
OK, now I'm using <a>.
Thanks for that.
But what about the JavaScript code?
Leave a comment on kayut's reply
jakecigar
Re: Building a form with JSON and Ajax
5 years ago
Maybe you are using <a>s in your head. But the plunker is not.
JΛ̊KE
Leave a comment on jakecigar's reply
kayut
Re: Building a form with JSON and Ajax
5 years ago
Hahahah....
I just changed <a> to div, as I don't see any difference.
jakecigar
Re: Re: Building a form with JSON and Ajax
5 years ago
You would have to make more changes than just that.
Without an updated plunk, I can't guess what you have done.
JΛ̊KE
Leave a comment on kayut's reply
jakecigar
Re: Building a form with JSON and Ajax
5 years ago
I suggest that you design without using AJAX. When you have something pretty that works, you can create the element dynamically with your JSON data.
JΛ̊KE
Leave a comment on jakecigar's reply
kayut
Re: Building a form with JSON and Ajax
5 years ago
Now I'm trying the same thing with another JSON file, but it doesn't work.
Building a FAQ
What is wrong with my code?
Leave a comment on kayut's reply
jakecigar
Re: Building a form with JSON and Ajax
5 years ago
see
https://plnkr.co/edit/h0MkdwmGhArQylOzndXf?p=preview
<--
JΛ̊KE
Leave a comment on jakecigar's reply
Change topic type
Topic Type :
Discussions
Questions
Ideas
Problems
No of days :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Change topic type
Cancel
Link this topic
Provide the permalink of a topic that is related to this topic
Permalink
Save
Close
Reply to kayut's question
Top
Reply
{"z43973856":[14737000007588004,14737000007588009,14737000007588011,14737000007588013,14737000007588015,14737000007588017],"z2950240":[14737000007593043,14737000007593047,14737000007593049,14737000007593051,14737000007593053,14737000007593055,14737000007593057]}
Statistics
12
Replies
1342
Views
1
Followers
Tags
Cancel
json
Actions
Permalink
Related Posts
Native JSON
JSON array
Autocomplete JSON
JSON error
Json
JSON Question