Loading...
Copy code
Close
Permalink
Close
Please tell us why you want to mark the subject as inappropriate.
(Maximum 200 characters)
Report Inappropriate
Cancel
Private Message
From :
guest
To :
Subject :
Content :
Type the characters you see in the picture below.
Send
Cancel
From :
guest
To :
Subject :
Content :
Type the characters you see in the picture below.
Send
Update
Cancel
Feedback
Email ID
Subject :
Comments :
Send
Cancel
Private Message
Type the characters you see in the picture below.
Type the characters you see in the picture below.
Attach files
Desktop
Google Docs
Each Attachment size should not exceed 1.0 MB.
Max no of attachments : 3
Loading User Profile...
guest
Response title
This is preview!
Attachments
Publish
Back to edit
Cancel
(
)
Sign In
New to this Portal? Click here to
Sign up
You can also use the below options to login
Login with Facebook
Login with Google
Login with Yahoo
jQuery
Plugins
UI
Meetups
Forum
Blog
About
Donate
All Forums
Recent Posts
Log In
Search
jQuery
Search
jQuery Forum
Screen name:
Naidu
Naidu's Profile
1
Posts
1
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Ideas
Problems
Expanded view
List view
Private Message
[JQuery Mobile, PhoneGap]: Getting undefined response in my ajax call from the java web service
[1Reply]
01-Oct-2014 05:26 AM
Forum:
jQuery Mobile
This is my Ajax Call:
var url="
http://192.168.1.6:8080/RESTfulProject/REST/VmsAccess/GetUsers/admin/jsonp";
$.ajax({
url: url,
type: "GET",
crossDomain: true,
contentType: "application/json; charset=utf-8",
dataType: "jsonp",
jsonpCallback: 'successCallback',
success: function(res, status)
{
console.log("Ajax Call Success............");
//var parsed_data = JSON.parse(res);
//var json = $.parseJSON(res);
console.log(res.responseText+"-----------"+status);
/*res = $.parseJSON(res.responseText);
console.log(res.admin_name)*/
//testing param
if( p == 'admin') {
//store
window.localStorage["username"] = u;
console.log("Login Success......"+ u);
$.mobile.changePage("#mainPage");
} else {
//navigator.notification.alert("Your login failed", function() {});
console.log("Login Failed......");
}
$("#submitButton").removeAttr("disabled");
},
error: function(jqXHR, textStatus, errorThrown) {
if (jqXHR.status == 500) {
console.log('Internal error: ' + jqXHR.responseText);
} else {
console.log('Unexpected error...'+jqXHR.responseText);
}
},
async: false,
cache: false
});
This is My Webservice:
@GET
@Path("/GetUsers/{username}/jsonp")
@Produces(MediaType.APPLICATION_JSON)
public Response feed(@PathParam("username") String param1)
{
String feeds = null;
try
{
ArrayList<FeedObjects> feedData = null;
ProjectManager projectManager= new ProjectManager();
feedData = projectManager.GetFeeds(param1);
//StringBuffer sb = new StringBuffer();
Gson gson = new Gson();
System.out.println(gson.toJson(feedData));
feeds = gson.toJson(feedData);
} catch (Exception e)
{
System.out.println("error");
}
//return "successCallback(" +feeds+ ");";
return Response.ok("successCallback(" +feeds+ ");").header("Access-Control-Allow-Origin", "*").build();
}
I am getting output:
Calling Ajax----------
Ajax Call Success---------
undefined------------success
«Prev
Next »
Moderate user : Naidu
Forum