Tagged Questions
4
votes
0answers
34 views
Tic Tac Toe Implemented With jQuery Table Pseudo-Buttons
Made this code myself. I was experimenting with making buttons from a table, and decided to make a game of tic-tac-toe with it.
The code loads from json a grid, and then makes a tic-tac-toe game with ...
0
votes
1answer
53 views
Optimizing JSON append template
I am fetching a list of messages from some JSON and appending each message as an LI within a UL. I have created the message template within jQuery to append each message to the document. My code works ...
1
vote
1answer
32 views
Using JS/JQuery to serve ads from a self-hosted advertisements solution
I'm working on a custom (self-hosted) ads solution that allows the users to create ad units (by uploading the banner image and target URL) and get the ad display code. A JSON response is returned (by ...
4
votes
2answers
60 views
Getting JSON with jQuery, creating a function that displays the data from two separate feeds
I have written my first JavaScript program from scratch and am looking for advice to check whether it is efficient and effective or how it could be improved.
...
1
vote
0answers
112 views
Populating an HTML table with JSON results
Could anyone suggest a better approach than the one I'm using now? I tried to keep it as minimal as possible, but this is the best I came up with. I did extensive research just to get to this point.
...
1
vote
0answers
58 views
Sending JSON from a checkbox form
I coded this, which is working but I think there is a better way to do this.. I have a form where the user can check from checkboxes. For each checkbox I have multiple info that I want to send to my ...
3
votes
2answers
422 views
Search and sort customers from JSON file
I have just completed my first JavaScript/jquery project. It searches customers from .JSON file and sorts them by name or ID. Everything just works fine. The thing is, I am not sure that I have ...
0
votes
1answer
65 views
List and post tasks with jQuery
I've written the code below to display a list of tasks from a Flask API. The form and associated .ajax method post to the API, immediately appending the data to the list of tasks. The code is working, ...
1
vote
1answer
55 views
Interpreting the time
EDIT: Alternate answer on overflow: https://stackoverflow.com/questions/38487692/how-can-i-interpret-the-time-with-less-code/38492144#38492144
But I really want to keep Jonah's answer here too. Just ...
2
votes
2answers
60 views
Retrieve data from json file and avoid HTML/JS tight coupling
I am retrieving data from a json object and even though code works I am not sure if I am following best practices.
In particular some of the objects seems too deep (like value.metadata.connections....
3
votes
1answer
102 views
Generating jQuery mobile “pages” dynamically
I'm doing a college assignment with jQuery Mobile and JSON. Best practice with jQuery mobile is my main concern.
My html starts off with a main 'page' (data-role="page") inside a div with id="all-...
0
votes
1answer
734 views
Wikipedia search using the JSON API
What could I do better in my code or logic?
Wikipedia Search
...
0
votes
1answer
64 views
Collect several API call results
Want to brush up my rusty web dev skills. I want to call the twitch API for several channels and eventually call a callback function when all results are in without using a sync call.
I didn't work ...
1
vote
2answers
2k views
Fetching data from nested JSON using jQuery and displaying in table
I'm displaying JSON data in a tabular format on a html page using jQuery.
In the function I'm looping the resp.DATA once to get the key names so it can be ...
0
votes
2answers
41 views
Building categories block based on JSON
I'm not even sure if this is how you're supposed to do it, but this is what I have so far:
...
1
vote
0answers
210 views
Appending JSON values to the DOM
My code below uses JSON to append images into the DOM. It works properly but I want to optimize my JavaScript to see if I can write it in fewer lines or if there are methods I can use that optimize my ...
4
votes
1answer
219 views
Iterate JSON GIF collection array to HTML file
I've written a piece of code which utilizes a for loop to iterate this array in JavaScript. This is my first attempt and I wonder if there is an optimal way to do ...
1
vote
0answers
219 views
5
votes
1answer
3k views
Creating a menu as nested unordered lists from JSON data
I have a JSON input using which I have written below function to recursively create an unordered list.
Is there more precise way to achieve it?
...
1
vote
2answers
279 views
Calculate discipline level from attendance record given a set of rules
I have written an attendance calculator that compares a set of rules against an employee's attendance record and determines what level of progressive discipline that employee is at (how much trouble ...
2
votes
1answer
4k views
Getting distinct array of objects
I would like to get a distinct array of objects. The code below is the first thing that came to mind.
Do you see any room for improvements?
...
2
votes
0answers
84 views
Improving JavaScript processing of Ruby Regex
I have a basic webapp that basically serves the same purpose as Rubular.com, but for gsub.
It runs some simple JavaScript, which POST's to a Sinatra app, which then updates page with the results.
<...
3
votes
2answers
722 views
Speed up loop through JSON
I have the following function that takes JSON and turns it into table rows:
...
3
votes
1answer
682 views
Loading and displaying JSON quickly in PhoneGap app
I have this tap event in an iOS app that I'm developing with PhoneGap. When I click on the left arrow, it finds the desired content and retrieves it from a JSON file. It then displays those results on ...
1
vote
1answer
20k views
Displaying data from JSON in a table
What do you think of my code? I know it is a little rough around the edges but as of two days ago I had no idea how to use jQuery or JavaScript.
...
6
votes
2answers
10k views
Insert JSON data into rendered template after AJAX call
I have an already rendered template and I want to update it with some JSON data I obtain via AJAX.
The template as it is before rendering looks like this (using ...
2
votes
2answers
2k views
Using jQuery and AJAX process a form with PHP
I'm looking to collect form input and pass it to a file called processing.php with AJAX
JS:
...
2
votes
1answer
158 views
JavaScript function for taking JSON data and formatting in to HTML table
I have written a JavaScript function that takes JSON encoded data and then, with conditionals, formats that data into a table.
I asked this question not so long ago but that was just a snippet of ...
3
votes
2answers
156 views
Better paradigms for posting JSON from a table?
With a table based interface where users can update the rows by pressing a button. Perhaps there is a better way of doing this, without pressing a button, i.e. post on textarea/row change (could be a ...
1
vote
0answers
482 views
Setting up a global site search using typeahead
I've written a "clever" bit of javascript that sets up typeahead and bloodhound for use as a global search facility.
To make this even more clever, I've stashed a date for when the search JSON that ...
2
votes
2answers
3k views
Interacting with database in MVC
When using MVC 4 Razor (I am new to web development), I get concerned about my understanding of interactions between the database and the client. Much like all appilications these days, there is a lot ...
2
votes
1answer
457 views
Instagram widget feed function
I've adapted an Instagram widget from this example so that it now appends 8 images to their respective IDs using an Instagram username. I want my widget implementation to be better and more efficient. ...
3
votes
1answer
388 views
Restructuring data received from JSON call
I'm making a JSON call and receiving data and inputting the data received into some HTML. However I don't think this is the best way to return the data. It's seems like a bit of a hack as I'm ...
1
vote
0answers
1k views
Generate HTML from JSON
I have to generate a lot of tables from different JSON files (up to 20 tables per page). Because it's a lot of data, I really want to keep loading speed in mind. I know it's better to use a non jQuery ...
6
votes
1answer
1k views
Load JSON file into model using Javascript / jQuery (deferred, asynchronous)
As a beginner I am always determined to improve myself. I've got written the following Code using jQuery that is working fine. However, I am sure that there are cleaner ways for achieving the same.
...
1
vote
2answers
2k views
How to handle JSON's undefined value in a better way?
I'm working on Google Book API to post a book's basic information. I notice that some of the books will always miss a value or two under volumeInfo, like this book (...
6
votes
1answer
121 views
Account-Creation form
How can I optimize the following PHP/JS code?
It works like a charm but I think it is too long and I'm sure it could be optimized. If I have another form, I'll need to copy paste some lines from my ...
30
votes
2answers
1k views
Random clothes generator
For the past four years I've attended a private school which requires its students to wear ties. I've found that it's far easier to figure out what combination of shirt, pants, and tie that go ...
6
votes
1answer
315 views
Dynamic toggle system
I'm new to jQuery/JSON and I've build an dynamic toggle system. It work fine, but I'm not sure about my code and I want a better way of building this.
Could you please see my code and give comments/...
3
votes
2answers
237 views
Find end of $.each() loop
I need to find the end of a loop or the length of the object. Some context on the code:
I obtain the txt var from the DOM (that's the only way I've got by now and ...
3
votes
3answers
395 views
JavaScript app to search GitHub using JSON API
I've written this simple JavaScript application for a homework assignment and I've received feedback saying it could be written better.
Can I get some feedback on how to write this differently? It ...
0
votes
2answers
186 views
More Efficient Javascript indexOf query
There is an e-commerce site that I'm working on that has thousands of pages in it (mostly product pages). I've got some jQuery that I'm running on about 1300 of these products. Only specific products ...
4
votes
1answer
3k views
Speed up slow loading images?
I have the following jquery mobile + phonegap app. I'm finding when I load the app, the images in the separate pages load pretty slowly. Any advice on how to speed up loading this app?
...
1
vote
2answers
125 views
Object iteration and appending to form
In this code, I'm getting the json from backend. Once I find the json availability, I loop and make 5 columns. Once the columns are made, I append after the legend of my form.
Can this be improved ...
2
votes
0answers
2k views
Data with Handlebars templating function
In my app development, I need to fetch data from backed, and it needs to implement it into an HTML page.
I've written the below code for this, but I think it's very lengthy. Can anyone give me ...
1
vote
1answer
180 views
Callback for job applicant
This is on a job listing site and it has a Linkedin apply button plugin - this provides for a callback the someone has applied for a job. I've written the callback function which extracts the Job ID (...
3
votes
2answers
176 views
jQuery form data
Could someone please help me make this code as professional as it can be? It works fine, but I feel there's a better way of doing this. I would really appreciate some guidance so I learn to code ...
3
votes
1answer
436 views
JQuery Promise Interface for a (very) simple JSON Parser
I have written a parser function that returns a JQuery Promise. You can see from the code that this is the top level parser and it delegates out to two other more specific parsers.
At the minute it ...
3
votes
1answer
6k views
Convert JSON to a different format (nested json)
This is really not a question. I was looking up this solution but couldn't find it anywhere. Thought of posting it here so it may save someone's time.
Here was my issue: I had a JSON coming from ...
5
votes
2answers
8k views
jQuery plugin $(node).toJSON() - convert html form to JS Object
GitHub project repo
I've been working on this little function to convert an HTML form into a JSON Object having the same structure of the form. Basically it is intended to be useful in those ...