[aerogear-dev] Replacing JQuery Ajax with Aerogear pipes
soumik.basu
soumik.basu at accenture.com
Sat Mar 30 00:55:55 EDT 2013
Hi,
I am trying to access my REST easy service from my html5 page. I tried to
access the REST url from JQuery AJAX and I can successfully do that and
get the data back in my html as given below:
$(document).ready(function(){
$.ajax({
type: "POST",
url: "../JAX_RS_HelloWorld/helloworld",
success: function(result){
alert(result);
}
});
*Rest Service code :*
@Path("/helloworld")
@RequestScoped
@Stateful
public class RSHelloWorld {
@GET
@Produces(MediaType.APPLICATION_JSON)
public String sayHello() {
System.out.println("i got hit");
return "Hello";
}
}
but I want to replace and use Aerogear pipes for this purpose.
I tried by following the example code and the document, as below:
*JS code:*
var memberPipe = AeroGear.Pipeline([{
name: "helloworld",
settings: {
baseURL: "/JAX_RS_HelloWorld/"
}
} ]).pipes.helloworld;
alert(memberPipe);*// this alert is coming as [object object]*
function getRestData(){
subs = memberPipe.read({
success: function(data) {
MemberStore.save( data );
alert("in function" + data);
},
error: function(jqXHR,textStatus,errorThrown){
alert("jq" + jqXHR);
alert("err" + errorThrown); *//I
am getting a parsing error here*
alert("status" + textStatus);
}
});
var testData = MemberStore.read();
alert("testData" + testData);
}
Would appreciate your help, in replacing the Jquery ajax call with the
aerogear .
Regards
Soumik Basu
--
View this message in context: http://aerogear-dev.1069024.n5.nabble.com/Replacing-JQuery-Ajax-with-Aerogear-pipes-tp2156.html
Sent from the aerogear-dev mailing list archive at Nabble.com.
More information about the aerogear-dev
mailing list