Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Mary O'Gorman
1,482 PointsBootstraps Table Select Radio without using json
I am trying to activate bootstraps Table Select Radio without using json. Has anyone done this before?
I only have a few data items in my list so don't want to link to an external database. Here is a link to the example on bootstrap.
http://wenzhixin.net.cn/p/bootstrap-table/docs/examples.html#table-select
1 Answer
Iain Simmons
Treehouse Moderator 32,305 PointsHaven't done it, but you can specify the type of data you want to get, if it's not JSON (which is the default). See the following option in the documentation
Name: dataType
Attribute: data-data-type
Type: String
Default: 'json'
Description: The type of data that you are expecting back from the server.
I think it expects an option similar to jQuery's ajax method:
dataType (default:
Intelligent Guess (xml, json, script, or html))Type: String
The type of data that you're expecting back from the server. If none is specified, jQuery will try to infer it based on the MIME type of the response (an XML MIME type will yield XML, in 1.4 JSON will yield a JavaScript object, in 1.4 script will execute the script, and anything else will be returned as a string). The available types (and the result passed as the first argument to > your success callback) are:
"xml": Returns a XML document that can be processed via jQuery.
"html": Returns HTML as plain text; included script tags are evaluated when > inserted in the DOM.
"script": Evaluates the response as JavaScript and returns it as plain text. Disables caching by appending a query string parameter,_=[TIMESTAMP], to the URL unless thecacheoption is set totrue. Note: This will turn POSTs into GETs for remote-domain requests.
"json": Evaluates the response as JSON and returns a JavaScript object. Cross-domain"json"requests are converted to"jsonp"unless the request includesjsonp: falsein its request options. The JSON data is parsed in a strict manner; any malformed JSON is rejected and a parse error is thrown. As of jQuery 1.9, an empty response is also rejected; the server should return a response ofnullor{}instead. (See json.org for more information on proper JSON formatting.)
"jsonp": Loads in a JSON block using JSONP. Adds an extra"?callback=?"to the end of your URL to specify the callback. Disables caching by appending a query string parameter,"_=[TIMESTAMP]", to the URL unless thecacheoption is set totrue.
"text": A plain text string.