How do I see the url that I'm using in $.getJSON

I have the following code snip and am trying to debug it. Is there a way to get the full url string that the .getJSON call is calling?

opts = {}; opts['start'] = startdate; opts['end'] = enddate; opts['email'] = addresses; $.getJSON(url_count_string, opts, function(data){ drawChart(data, chartsData['hourChart']); });

-------------Problems Reply------------

Firefox w/Firebug - "Net" tab.

Chrome - "Network" tab.

IE9 - "Network" tab.

Safari - "Network" tab.

Opera - Dragonfly "Network" tab.

if your url_count_string is relative & what you want to see if full url, then append url_count_string to current path.

If what you want to see is url with request params appended (x=123&y=456....), try to see XHR Net Panel in Firebug.

You know that the method is making a GET request, so it must be appending the data in the standard way.

Using this answer, we can do this:

function createGetParams(data) {
var ret = [];
for (var d in data) {
ret.push(encodeURIComponent(d) + "=" + encodeURIComponent(data[d]));
}
return ret.join("&");
}

var finalURL = url_count_string + '?' + createGetParams(opts);

Assuming the opts array and url_count_string variables are defined as they are in your question.

finalURL will be the URL that jQuery is sending the request to.

Category:jquery Views:1 Time:2011-09-19

Related post

  • Construct the URL from JSON feed 2011-11-04

    Could anyone please advise me of what am I doing wrong here? I am trying to construct the image URL but using the flickr.photos.search method now (I need to display images close to geolocation of the visitor), I had it working before with groups_pool

  • How to get the Json object for drop down? 2009-04-14

    after trying much more on cascading drop down I decided to do it by Jquery. This is in my cityController public ActionResult States(int id) { AcademicERP.Models.AcademicERPDataContext dc = new AcademicERPDataContext(); var states = from s in dc.State

  • jquery .get/.post not working on ie 7 or 8, works fine in ff 2009-05-01

    I have basically this on a page: <script type="text/javascript"> function refresh_context() { $("#ajax-context").html("Searching..."); $.get("/ajax/ldap_search.php", {cn: $("#username").val()}, function(xml) { $("#ajax-context").html($("display

  • How to get an ASP.NET MVC Ajax response to redirect to new page instead of inserting view into UpdateTargetId? 2009-10-08

    I am using the Ajax.BeginForm to create a form the will do an ajax postback to a certain controller action and then if the action is successful, the user should get redirected to another page (if the action fails then a status message gets displayed

  • Access to restricted URI denied" code: "1012 - Cross domain Ajax request 2009-11-05

    I Need to do cross domain Ajax request - Here is my code $.ajax( { url: redirectURL, data: $('#login-container form').serialize() + querystring, type: 'post', cache: false, dataType: 'jsonp', jsonp: 'jsonp_callback', }); Error: [Exception... "Access

  • Assign variable to manipulated data from jQuery getJSON results 2010-01-07

    How to assign a variable to returned JSON data that has been manipulated with .replace() as shown below. Purpose: build the URL for the video thumbnail image from video ID returned by JSON. Question: How to assign a video ID (ex. mVWhWsgHzKM) to a va

  • disable select dropdown during .getjson jquery call and reenable after complete 2010-01-10

    i have the following code where i getJSON after i click on a select box. Sometimes it takes a long time and the users are clicking on the dropdown again during the server side processing. Is there anyway to disable the dropdown during the server side

  • What are the differences between JSON and JSONP? 2010-05-22

    Format wise, file type wise and practical use wise? --------------Solutions------------- JSONP is JSON with padding, that is, you put a string at the beginning and a pair of parenthesis around it. For example: //JSON {"name":"stackoverflow","id":5} /

  • Problem in JsonResult 2010-05-26

    I am using the jsonresult for listing all the cities under a country. I retrieve the data from database and load it to a dropdown list using jquery. The problem is if the cities goes beyond 3000 then the jsonresult is not working. <script type="te

  • $.getJSON to get JSONP data 2010-07-14

    I was playing with $.getJSON in the following way to receive an alert but without luck. Here is the code, <script type="text/javascript"> $(document).ready(function() { var url = "ticker.js?callback=?"; $.getJSON(url, function(data) { alert(dat

  • How to reload JSON with AJAX every 10 Seconds 2010-09-27

    I'm trying to reload a JSON file every 10 seconds with JQUERY. The page is here: http://moemonty.com/chirp/chirp.html The Code is here: <html> <head> <title>the title</title> <!-- included Jquery Library --> <script t

  • SmartGwt - Load Grid Data From JSON 2010-10-07

    I am trying to get started with SmartGwt. I am using the XJSONDatasource to make a cross-domain call to an example page at SmartClient that has JSON data. When I run the code, however, a popup comes up that says "Finding Records that match your crite

  • How to check if page exists using Javascript 2010-10-13

    <a href="http://www.example.com">Hello</a> when I click the link it should check whether the page exists or not. If it exists it goes to that page (www.example.com) but if the page doesn't exist it redirects to another URL. --------------

  • checking the page exist or not using javascript 2010-10-13

    <a href="http://www.example.com">Hello</a> when I click the link it should check whether the page exists or not. If it exists it goes to that page (www.example.com) but if the page doesn't exist it redirects to another URL. --------------

  • Use JSONP To Return an Array From PHP to JavaScript 2010-11-09

    I am attempting to use JSONP to return an array from PHP to JavaScript. Hopefully, my code will demonstrate exactly what I'm trying to do because I am not even so sure how to word it... My PHP file, port 80, hence the need to use JSONP and not JSON (

  • need help with a simple jQuery problem 2010-12-03

    i have a textbox. when the user tabs out of it (.change) - i want to run a json query to get a single string and populate a textbox with it. everything works fine except the fill on the callback. every single demo/bit of code i can find deals strictl

  • Get Vimeo thumbnail for video using jQuery 2011-01-17

    I've found similar questions but none of the answers show clearly and easily how to get a thumbnail for a vimeo video using jQuery and JSON. If anyone can help that would be great, here is what I've got but it shows nothing at the moment. var vimeoVi

  • Appending an extra request to JSON callback 2011-02-04

    My Problem I am trying to load JSON encoded data from a remote site using jQuery, however when jQuery tries to call this URL it appends the correct function to callback=? so it's something like callback=jsonp1256856769 but it also adds _=1256856769 t

  • AsyncTask Android - Design Pattern and Return Values 2011-02-20

    I'm writing an application that validates login credentials on an external webserver - so I have the basic issue of creating a login screen that when submitted will send an HTTP request to a server in the background and not cause the UI to hang - whi

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.141 (s). 11 q(s)