I will try and word this question the best I can, for it is very hard to explain. Basically, I am building a phonegap iphone application that connects to this news site and parses the main articles for reading, using mostly the jQuery function load(). the problem is, the site has an iffy mobile version that, when accessed using an iphone, sometimes automatically loads the mobile site and other times loads the main site. They have different reference classes and ID’s so (as I built around the mobile site) if the main site is loaded, my app is completely useless. The website does have a script that sets (most likely) a session variable that determines whether to load the mobile or desktop sites, and it is found here:
http://www.macrumors.com/mr-toggleMobile.php?mobile=1
A 1 will set the mobile site and a 0 will set the desktop site. It works both on mobile safari and normal safari. Is there a way, using this script and javascript/jquery, to change when using the load() method whether it pulls the mobile site or desktop? (I would need desktop in a few cases). Thanks!
Instead of using
load(), useajax().This way you can set up the
dataoption for the url. Here is the explanation ofdata:"Data to be sent to the server. It is converted to a query string, if not already a string. It's appended to the url for GET-requests. See processData option to prevent this automatic processing. Object must be Key/Value pairs. If value is an Array, jQuery serializes multiple values with same key based on the value of the traditional setting (described below)."For e.g.:
Since you said sometimes you need one or other, you could make a function:
Then you call like:
For more descriptions and options, check $.ajax() at jQuery’s API Page