Hey All,
Update 1: I've tried using all the other servers I've got installed, AMFPHP and XMLRPC and I get nothing back as well. I did this just to see if maybe it was the json server. The message I'm getting from JSON is the same one I get when you go to /services/json from the browser.
Like the title says I'm new to services and not having the smoothest entrance into this world. Building the service was a straight forward and had my very own services up and running in no time. Where I'm having a struggle is getting access to these services through JavaScript.
I've seen this article, http://drupal.org/node/305819, which says to use Drupal.service() but it's not clear where you should be calling the json_load to include the appropriate JavaScript files. I've tried using jQuery's .ajax and getJSON as well but keep getting the error back saying "#data:" "Invalid Method"
$.ajax({
url: "/services/json",
dataType: "text",
data: {"method": "car_service.get_product_listing", "tids": "28"},
success: alertMe,
});
function alertMe(response){
alert(response);
}Is there a resource I've missed somewhere along my journey's which will help me out or give me a good point in the right direction.
Cheers,
Gene Bernier
Comments
Got it Working
Hey,
Incase anyone else comes along trying to do what I did using jQuery here's a few things you need to know.
Here's the code I'm using and it is work, my service method returns a string of html to me
$.ajax({
type: "POST",
url: "http://carccessory.acro.dev/services/json",
dataType: "json",
data: "method=car_service.get_product_listing&tids=28",
success: populateProductListing,
});
function populateProductListing(response){
if(!response['#error']){
$("#productListingContainer").html(response['#data']);
}
}
Hope this saves someone else a few minutes of frustration