javascript - Using AJAX with jQuery -


how get information in xml file , read array on object i'd able access function? what's best way go this? i'm using jquery , ajax.

thanks, elliot bonneville


edit: here's example code of have far:

function getquestions() {         $.ajax({             type: "get",             url: "questions.xml",             datatype: "xml",             success: function(xml) {                 x = 0;                 x = $(xml).find('questions').length;                  var questionid = $.random(x);                  //here's need iterate through questions find 1 id specified random var above.             }         }     } 

you use $.get:

$.get('content/file.xml', function(data) {    // convert json easier manipulation }, "xml"); 

as want "access function", you'd need convert xml json.

there no built-in functionality - you'd need plugin 1 here.

which begs question - why not return json server in first place?


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -