Results 1 to 10 of 10

Thread: [RESOLVED] JSON Not letting me post a URL?

  1. #1

    Thread Starter
    eltiT resU motsuC Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Resolved [RESOLVED] JSON Not letting me post a URL?

    How do you all a URL to pass thru json?

    http:// is breaking it... im guessing its the // because if I remove one it works...

    Code:
    $('#save_social').click(function() {
                    	$('.wait').show();
                      $('.wait').fadeIn(400).html('<img src="images/loading.gif" />');
                      var user_fb=$('#fb_name').val();
                      var user_tw=$('#tw_name').val();
                      var user_id=$('#usrid').val();
                      $.ajax({
                                type: "POST",
                                url: "functions/soc.php",
                                data: { fb: user_fb, tw: user_tw, uid: user_id },
                                dataType: "json",
                                cache: false,
                                success: function(result){
                                	if(result.stat=='fail'){
    			                      		$('.wait').addClass("red");
    			                      		$('.wait').fadeIn(400).html(result.query);
                                	}else{
                                		$('.wait').removeClass("red");
    			                      		$('.wait').fadeIn(400).html("");
    			                      		$('#edit_user').hide();
                                	}
                                }
                               });
                    	
                    });
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  2. #2
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,621

    Re: JSON Not letting me post a URL?

    I don't think php passes different than asp.net, as i pass it in the same way (for a service "myservice.svc/getfunction"). I am not sure though how would you pass this on remote domains. I think http:// is needed there + more stuff. So I am not sure on what of these your are trying here.
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  3. #3
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: JSON Not letting me post a URL?

    Are you saying that you want to specify http:// here?

    Code:
    url: "functions/soc.php",

    *** 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
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,567

    Re: JSON Not letting me post a URL?

    JSON isn't the issue.
    This is the JSON here: { fb: user_fb, tw: user_tw, uid: user_id }
    There's no URL in there anywhere. If you're talking about the same segment that szlamany is talking about "url: "functions/soc.php" that's just JS/AJAX, has nothing to do with JSON.

    I think you're going to need to be a little more specific in your description.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5

    Thread Starter
    eltiT resU motsuC Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: JSON Not letting me post a URL?

    no lol

    the VALUE of var user_fb=$('#fb_name').val(); will be a URL
    so it breaks it as it tries to pass the url through json to the php... its like I need to escape the /'s but cant seem to make that work?
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  6. #6
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,567

    Re: JSON Not letting me post a URL?

    Sounds like it might need to be encoded.
    http://stackoverflow.com/questions/8...rome-extension

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  7. #7
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: JSON Not letting me post a URL?

    I never have to deal with escaping data coming from the browser - have to worry about it the other way around.

    Where is the error you are getting? What error? Backend error? JS blowing up?

    *** 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

  8. #8

    Thread Starter
    eltiT resU motsuC Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: JSON Not letting me post a URL?

    I am not running it in a debugger , but the JS is stopping right at the point it needs to send the data to the php file...
    I will try encoding it...if you remove one / it works. http:/blah.blah - so its seeing the // as something odd
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  9. #9
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,567

    Re: JSON Not letting me post a URL?

    well, can you assume the http:// ? I'm wondering if maybe you simply strip http:// off of the URL, send it over, then on the server add the http:// back in. Just a thought.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  10. #10

    Thread Starter
    eltiT resU motsuC Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: JSON Not letting me post a URL?




    well... I suppose that might work.... Im going to go drink now. lol
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

Posting Permissions

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



Click Here to Expand Forum to Full Width