-
Dec 3rd, 2014, 05:17 PM
#1
[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"
-
Dec 4th, 2014, 02:44 AM
#2
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.
ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·
-
Dec 4th, 2014, 05:24 AM
#3
Re: JSON Not letting me post a URL?
Are you saying that you want to specify http:// here?
Code:
url: "functions/soc.php",
-
Dec 4th, 2014, 07:59 AM
#4
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
-
Dec 4th, 2014, 10:37 PM
#5
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"
-
Dec 4th, 2014, 11:33 PM
#6
Re: JSON Not letting me post a URL?
-
Dec 5th, 2014, 05:16 AM
#7
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?
-
Dec 5th, 2014, 09:02 AM
#8
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"
-
Dec 5th, 2014, 09:08 AM
#9
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
-
Dec 5th, 2014, 03:48 PM
#10
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|