Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2012
    Posts
    1
    Rep Power
    0

    Default Uncaught SyntaxError: Unexpected token <

    My java web service

    public String pos(){
    System.out.println("post");
    return "{'vbak_id':'1000136'}";
    }


    When i run this web service in browser output is look like this

    <ns:posResponse xmlns:ns="http://novel.com">
    <ns:return>{'vbak_id':'1000136'}</ns:return>
    </ns:posResponse>

    Jquery to call this web service

    $.ajax({
    type: "POST",
    url: url,
    data: data,
    contentType: "application/xml; Charset=utf-8",
    dataType: "jsonp text xml html",
    crossDomain: true,
    rootProperty:'results',
    success: function(data){
    var array = $(data).find('return').map(function () {
    return $(this).text();
    }).get(0);
    successcallback(array);
    },
    error: errorcallback
    });
    }


    I am able call this Using GET Method but when i call using POST method i call web service but data is not retrieve pls help me if jquery is not right

  2. #2
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    7

    Default Re: Uncaught SyntaxError: Unexpected token <

    So, I don't know how your web service is written, but most frameworks limit what methods are allowed and how those methods can be formed. For example, a GET request generally includes the params in the URL while a POST usually includes them in the body. If your service is only accepting GET, the POST will be ignored. If it accepts both but isn't looking at the body of the POST request, then it just won't see any params at all.

    Verify what you actually support.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,232
    Rep Power
    19

    Default Re: Uncaught SyntaxError: Unexpected token <

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Uncaught error. What's this? (big headache!)
    By mathidioticz in forum New To Java
    Replies: 8
    Last Post: 02-04-2012, 06:41 PM
  2. Replies: 0
    Last Post: 12-09-2011, 10:28 PM
  3. Uncaught error fetching image
    By Manfizy in forum New To Java
    Replies: 9
    Last Post: 12-03-2011, 04:16 PM
  4. Replies: 2
    Last Post: 11-21-2011, 11:09 AM
  5. Do uncaught errors appear in the PrintStream?
    By arnab321 in forum New To Java
    Replies: 1
    Last Post: 02-26-2009, 08:56 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •