What's wrong with my AJAX request?

I have written a SOAP service that has a number of different methods.  I have tested these with php clients and each method works fine.

Now I am trying to access the service using jQuery AJAX.

I think the problem relates to my URL rather than the parameters but I'm not entirely sure.

Any pointers?

<script>
function getGroups() {
			{
                  $('#div1').load("/server.php?getSubGroupsOfType",{"ParentGroupID":81,"TypeID":25});
			}
}
$(document).ready(function(){
  getGroups();
  });
;
</script>

Open in new window


I am specifically interested in whether calling a method of a service using

?getSubGroupsOfType

Open in new window


in the URL is valid or not
markremmsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

markremmsAuthor Commented:
The php call I have used using a nuSOAP client is:
$result = $c->call('getSubGroupsOfType', array('ParentGroupID'=>$ParentGroupID, 'TypeID'=>$TypeID));

Open in new window

In my javascript I have deliberately used values that I know will have a result for ParentGroupID and TypeID.
0
markremmsAuthor Commented:
I get a POST 500 internal server error which makes me think that the request is badly formed.
0
RobOwner (Aidellio)Commented:
?getSubGroupsOfType

What gave you the idea to use this?  Typically the SOAP call would happen in PHP, not at the client so you would pass the method as a parameter as well:

$('#div1').load("/server.php",{"method": "getSubGroupsOfType", "ParentGroupID":81,"TypeID":25});

Then parse the method and parameters in server.php and in turn make the SOAP call.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

markremmsAuthor Commented:
Hmm - I thought that it was going to be possible to do the call direct to the server.  If not then I do have php clients that already work - just wasn't what I was expecting to do.

Thanks for the suggestion.

is a direct call really not a possibility?
0
RobOwner (Aidellio)Commented:
Is it on the same domain?
0
markremmsAuthor Commented:
It is at the moment but in the end I want to allow external access.  I know that is another issue but I want to get it working locally in the first place.
0
markremmsAuthor Commented:
BTW - I can confirm that using the php client does give me results.  So that is a solution even if it's not what I was expecting!
0
RobOwner (Aidellio)Commented:
:) sure, not the one you wanted.

Can you post your server.php code?  How does it process the parameters?  Is it a class with methods?
0
markremmsAuthor Commented:
It's built using nuSOAP and yes it is a class with methods.

I have built a php client for each method and they work fine when called from a form.

I have now established that they are also fine if called from $('#div1').load too.

I'm about to give you the points for this and set up a related question if you're still around?
0
markremmsAuthor Commented:
Not the solution I expected but totally workable
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
AJAX

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.