code:
var jsonp = { currentscript: null, getjson: function(url, data, callback) { var src = url + (url.indexof("?")+1 ? "&" : "?"); var head = document.getelementsbytagname("head")[0]; var newscript = document.createelement("script"); var params = []; var param_name = "" this.success = callback; data["callback"] = "jsonp.success"; for(param_name in data){ params.push(param_name + "=" + encodeuricomponent(data[param_name])); } src += params.join("&"); newscript.type = "text/javascript"; newscript.src = src; if(this.currentscript) head.removechild(currentscript); head.appendchild(newscript); }, success: null }; function jsontables(element) { // vars this.element = element; // id of table this.url = "https://webservices.mysite.com/table"; this.data = { timestamp: (+new date()), idisplaystart: idisplaystart, idisplaylength: limit, icolumns: 6, isortingcols: 1, isortcol_0: current_sort_order, ssortdir_0: current_sort_type, ssearch: filter }; jsonp.getjson(this.url, this.data, function(data) { this.jsondata = data; console.log(this.jsondata); // 1 displays ok }); console.log(this.jsondata); // 1 error // draws table this.drawtable(); // makes sortable this.sortable(); };
in code here have problem console.log in jsonp.getjson returning outputting data console, 1 labeled "this error" says undefined.
how go getting data this.jsondata?
Forums Special Interests Web Design and Development
- iPhone
- Mac OS & System Software
- iPad
- Apple Watch
- Notebooks
- iTunes
- Apple ID
- iCloud
- Desktop Computers
- Apple Music
- Professional Applications
- iPod
- iWork
- Apple TV
- iLife
- Wireless
No comments:
Post a Comment