There will be a list of "plans" that the user has, and I want to be able to click on any of them (separated by divs) and have its information dynamically loaded from the database.
My question is whether I should use a jQuery tab interface and load the content that way, or a button which triggers an ajax call? Is there any easier/prettier way to do this that I'm not thinking of?
Thank you for any help, it is much appreciated!
There are many existing solutions online . You can roll your own too . Here are some samples which has many with AJAX content loading . You can either use existing or change then as you need.
http://flowplayer.org/tools/demos/tabs/ajax.html . You can change .html to your own php,asp ,jsp what ever pages and pass plan id and page can return HTML .
http://webdesignledger.com/tutorials/11-useful-jquery-tab-navigation-solutions
http://www.hongkiat.com/blog/50-nice-clean-css-tab-based-navigation-scripts/
http://justintadlock.com/archives/2007/11/07/how-to-create-tabs-using-jquery
I used the jquery-jvert-tabs plugin for something very similar. Each tab had its content dynamically loaded and the whole div was called via ajax, it worked pretty well together.
Talking about which one is prettier, it doesn't matter whichever you choose if you just make sure is cohesive with your overall design :)
I would use tabs- no need to have a separate button if the plan name can be the tab name.
Design should almost always focus on usability and it seems like this approach would serve that goal well.
If your list of plans; however, is dynamic or can grow overtime then I would go with a dropdown populated with the list and a button that gets the details or wire up on onchange event and get the data.
The question is a bit vague so maybe if you provided more information we could better help you here.
Related
I created a html page, where the user can create a button via javascript/jquery, which will appear on the html page after adding it.
So my question is, how it is possible that the button will be there also if I am closing an opening the page again?
I hope my question is clear, I can also post my code if it is necessary! Thanks!
You will need to use some server side code to do this.
You cannot rely on cookies since they will be gone sooner or later.
PHP with MySQL to store the information you need seems like the easiest approach for some simple user database interaction.
There's not much to work with here hope you find this response helpful and guiding you the right direction.
My website has individual pages for members, but I have a select menu used to scroll from one member to the other. I have the select menu coded in the html on every page, but I need a better solution since my membership is growing.
I need to be able to create that same select menu in a separate file with the ability, when selected to jump to another member page, have that embedded in the body where I need it so that all I have to do is alter/ update the external file and it'll be done for all the member pages.
I've looked into javascripting it, mysqling it, but can't find (looking on youtube) a code to exactly help me in what I need.
My typical code for the select
//(select.....
//(option value="http:www.website-Profile-blahblah.html.... so on and so forth.
I need to pull this from an external file to use across the board and place it in the body where I need it.
thanks for any help you can offer.
In general this sounds like something you should be using a back end rendering engine for. As far as the select goes, this would be a great place to use a dropdown menu such as the one provided by bootstrap since clicking a select won't actually move you to another page.
If you dont want to use/can't use a back end rendering engine to render the options, I would suggest looking at angular.js which has a great ng-repeat and ng-option feature that would allow you to dynamically build the select/dropdown with as many users as you want.
angular ng-repeat page: https://docs.angularjs.org/api/ng/directive/ngRepeat
bootstrap dropdown: http://www.w3schools.com/bootstrap/bootstrap_dropdowns.asp (note the a tags could go directly to the user's page)
From experience in cases like this, it is much easier to have an SQL table to store the links you would like to use. The next thing to do is to have your back-end send you the list of links. With this, you can dynamically create the option tag and append it to your select tag. functions like newOptionTag.setAttribute('value', 'url'),document.createElement('option') and selectElement.appendChild(newOptionTag) should help you on your way
If you really want to use a seperate file, you could store the membernames and links in a json file. On document load get the file, parse it, then use the object to build the options.
The w3schools website (though frowned upon by some) has a json tutorial and an example that is already halfway there.
EDIT: I see it actually uses mysql to build the json file...
At my company, we are debating this. Say you have a color swatches that is already built in product detail page. At the category page, where each products are displayed, doesn't have color swatches. So we are trying to build one. I was suggesting if we can use jquery or javascript to crawl it, cache it or drag it from the pdp and display it in category page. If we do that, it probably gonna be very slow because the category page is going to hit the server many times.
Additional info, we don't have access to the php codes, so only javascript, jquery and html is possible.
I am actually looking for a way to do that. of course, it has to run fast too. Any suggestions of possibility anyone?
i dont think it is possible, your jquery or javascript should be native to the page to read its contents, ok lets assume it is native and you can read the content but where do you store ? with only javascript and jquery and not much of server side it is impossible
I'm wondering if doing this along in JQuery would be stable enough? or if it would need to be done in ruby/rails first?
Either way I don't want a butt load of messages being loaded when a user enters the page where they're displayed. What I want is limit results to a specific amount then either have the page load more results when a user scrolls down or have them click a "load more" button similar to how it's done on both facebook and googleplus.
Currently I have comments scrolling down my page for miles and would like to use jQuery to take control of this. I'm guessing since each comment is stored in a div / class I could use this as a way of recognising what a comment is.
Anyway trying to figure out the best way to approach this I'd really appreciate some advice and maybe links to some good tutorials on how to pull this off.
I agree with the Ohgodwhy's comment - use will_paginate in Rails.
However, I'd also look at how to do scroll-down pagination, rather than page number links, depending on your design. I like Ryan Bates's screencast on this topic: http://railscasts.com/episodes/174-pagination-with-ajax
He also has a video for doing it without will_paginate: http://railscasts.com/episodes/114-endless-page (the newer, revised version of this requires a subscription).
I just need a little advice on what may be the best method for handling my situation.
I'm in need of placing three buttons in the sidebar of the website I maintain. The website is massive and hard to handle. Currently, it's all HTML files (there are over 10,000 of them believe it or not). We're transitioning to a database website so I don't want to make any sweeping changes that are site-wide, as they may just be scrapped in our re-design process in coming months.
However, these buttons are for an application process. When you click on them, an alert box will need to pop up to give you a bit of information and they either allow you to cancel the action or proceed. The buttons are currently located in the left nav which is included on every page of the website.
Would it be possible to accomplish this using JS or jQuery? I'd be unable to easily add scripts into the tags on all of the applicable pages, but I'd like to avoid the browser driven "http://www...Says: blah blah" message if possible. Any insight is greatly appreciated! Thank you!
Check out the jQueryUI dialog examples, particularly the modal boxes, although you will have to add the script to every page.