[RESOLVED] Wow - can't pass ?? in ajax web service call-VBForums
Results 1 to 6 of 6

Thread: [RESOLVED] Wow - can't pass ?? in ajax web service call

Hybrid View

  1. #1

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    CT
    Posts
    15,542

    Resolved [RESOLVED] Wow - can't pass ?? in ajax web service call

    I cannot pass ?? as data in a JSON object to a web service.

    One ? will save - two (??) will not!

    The image below shows the $.ajax call - it never makes it to the VB web service (I set a break point in that code) - it appears to be getting rejected by the IIS process.

    Interestingly enough you can see that I'm passing in "a??" as the data - and the "parseerror" is coming back with the "a??" changed to

    "ajQuery15204.........."

    I did read about ?? being some kind of php query separator - I'm not using php...

    What the heck is going on here??
    Attached Images Attached Images  
    Last edited by szlamany; Feb 2nd, 2012 at 04:29 AM.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  2. #2
    Moderator
    Join Date
    Jan 2005
    Location
    Sydney
    Posts
    13,621

    Re: Wow - can't pass ?? in ajax web service call

    The question mark is a control character in HTTP requests.

    Check out
    http://stackoverflow.com/questions/5...cutive-questio

  3. #3

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    CT
    Posts
    15,542

    Re: Wow - can't pass ?? in ajax web service call

    Thanks - that link deals directly with this problem - although I'm not sure I see a simple answer in that link - I've to to eat dinner and come back to this later!

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  4. #4

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    CT
    Posts
    15,542

    Re: Wow - can't pass ?? in ajax web service call

    That link was all over the place - and the solutions offered were not strong.

    Did you google for that - or do you know that to be a solution to this issue?

    I'm about this "close" to escaping the ?? marks - can I do that somehow?

    Like with

    \u#### for the question marks?

    Or do I have to roll my own internal escaping for this?

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  5. #5
    Moderator
    Join Date
    Jan 2005
    Location
    Sydney
    Posts
    13,621

    Re: Wow - can't pass ?? in ajax web service call

    I couldn't reproduce your issue. It could be that it has been fixed in the jQuery source.

    This works for me using jQuery 1.7.1:
    Code:
    var obj = { 'foo': '??' };
    $.ajax({
    	type: 'POST',
    	url: 'http://localhost/test10.php',
    	contentType: 'application/json; charset=utf-8',
    	data: JSON.stringify(obj),
    	success: function(msg) {
    		console.info(msg);
    	}
    });

    This sends the JSON string as the body of the POST request. While this is valid HTTP, it is atypical. Usually POST requests consist of a set of name/value pairs, which is denoted by the content type application/x-www-form-urlencoded.

    You can send a request of this form using $.post:
    Code:
    $.post(
    	'http://localhost/test10.php',
    	{'json': JSON.stringify(obj)},
    	function(msg) {
    		console.info(msg);
    	}
    );
    Note that in this case, the JSON string is passed as a parameter named 'json'.

  6. #6

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    CT
    Posts
    15,542

    Re: Wow - can't pass ?? in ajax web service call

    Yes - it's fixed in jQuery 1.7.1

    Here was the bug ticket - seems they didn't believe/understand the problem for quite a while!

    http://bugs.jquery.com/ticket/8417

    btw - I'm talking to asp.net web services with this app - so IIS is doing the unraveling of the ajax calls...

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.