backbone.js - Reload the page to get source for: http://localhost:8080/PSWebServices/services/EmpDetails -


hi facing issue while accessing response restful ws using backbone.

i have created ws on local machine returning json array

            jsonarray empdatajsonarray = new jsonarray();     jsonobject empdata = new jsonobject();     try     {            empdata.put("id", emp.getempid());         empdata.put("firstname", emp.getfname());         empdata.put("lastname", emp.getlname());         empdata.put("age", emp.getrcount());         empdata.put("city", emp.getcity());         empdata.put("country", emp.getcountry());     }     catch(jsonexception jsonex) {         throw jsonex;     }     return empdatajsonarray.put(empdata);  

when access ws browse.

 http://localhost:8080/pswebservices/services/empdetails 

i result [{"id":"033451","firstname":"naveen","lastname":"kapoor","age":10,"city":"bangalore","country":"india"}]

but when trying access same backbone code

$.ajaxprefilter( function( options, originaloptions, jqxhr ) {     options.url = 'http://localhost:8080/pswebservices/services' + options.url; });  var users = backbone.model.extend({     url : '/empdetails' });  var userlist = backbone.view.extend({ el:".page", render:function(){ var = this;  var users = new users();  users.fetch({  success: function(m,r){       console.log("success");       console.log(r); // => 2 (collection have been populated)     },     error: function(m,r) {       console.log("error");       console.log('error arguments: ', arguments);     }                  });              }         });  

while debugging on firefox in network tab can see 200 ok response. options empdetails
200 ok
578 b header response below : http/1.1 200 ok server: apache-coyote/1.1 allow: options,head,get content-type: application/vnd.sun.wadl+xml content-length: 578 date: mon, 24 mar 2014 06:30:48 gmt

but when response can see below message "reload page source for:

http://localhost:8080/pswebservices/services/empdetails" 

when added arguments in console log see error see xhr status below. need on missing. xhr: object { readystate=4, status=404, statustext="error", more...}

readystate : 4
responsejson : undefined
status : 404
statustext : "error"


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -