JQuery :: Using Data Outside Of GetJSON Call
Jun 7, 2009
I'm using Christophe Beyls' Slimbox 2 to get the lightbox effect on a gallery of Flickr images on my site, and I'm trying to modify it to grab the description of the image and put it in the title of the lightbox. The photo id is already given, but I'm not sure how to get the description out of the anonymous function so I can concatenate it to the linkMapper return (el.title).
Code JavaScript:
linkMapper = linkMapper || function(el) {
var uri = 'http://api.flickr.com/services/rest/?api_key=[key]&format=json&method=flickr.photos.getInfo&photo_id=' + el.id + '&jsoncallback=?';
$.getJSON(uri, function(data) {
[Code].....
View 1 Replies
ADVERTISEMENT
Jan 12, 2011
I use $.getJSON for making an ajax call. This is the code.
$.getJSON("json/",
{cname:$("#customerNameId").val(),email:$("#customerEmailId").val()},
function(data){
alert(data);
});
The data is sent to the server, I also get a response from the server. My firebug shows the response as the value I sent from the server.
But the callback function is not called... The alert never happens
View 2 Replies
View Related
Dec 9, 2009
Can you see an ajax call in Firebug when using $.getJSON? If so, does it return the jsonobject correct? Maybe there are some enters or something in front of the json?
View 4 Replies
View Related
May 19, 2010
Although i used getJSON in [url] i have not been able to connect with any of my own made up data. i tried 4, and the example at Flickr for "cats".
Only the latter worked... this is the output:
I am at that "base", as i did get the image there, but
[url]
[url]
[url]
[url]
Were all invisible==null!
How do i get "my" data into the page?
View 5 Replies
View Related
Dec 21, 2009
I have this basic code following and its not returning anything at all. Even the alert is not alerting. I have checked and the select is sending the value fine But nothing happens on return. What i am missing?
$(function() {
View 3 Replies
View Related
Mar 3, 2011
I have used getSON() successfully before but I am meeting with an issue which I don't seem to get a hold on. The data object returned is not populated correctly by getJSON(). Am I doing something wrong?
[Code]...
View 3 Replies
View Related
Jan 29, 2010
function get_something(){$.getJSON("get_something.php",function(json){ console.log(json.something);
How would I use the value of json.something outside of the get_something(); function?
View 4 Replies
View Related
Oct 20, 2009
In the code below the second alert is executed before the first one making it show the "empty" content, and not the result from the .json file. Why, and how can I make it work? getjson.html file
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL]">
<html xmlns="[URL]"><head>
<title>getJson</title>
<script type="text/javascript" src="[URL]"></script>
<script type="text/javascript">
$(document).ready(function(){
var content = 'empty';
$.getJSON("getjson.json",
function(json){
content = json.layout.template[1].content;
alert(content);//This work
});
alert(content); //This don't
});
</script>
</head>
<body></body>
</html>
getjson.json file {
"layout": {
"template": [ {
"key": "01",
"content": "<span id="span1">010101</span>" },{
"key": "02",
"content": "<span id="span2">020202</span>" },{
"key": "03",
"content": "<span id="span3">030303</span>"
}]}}
View 2 Replies
View Related
Feb 20, 2010
I have the following javascript:
<script type="text/javascript">
$(document).ready(function(){
// autocomplete setup
[code]....
The autocomplete (I'm using this one) and the getJSON work perfectly. The problem comes when I try to do something with the returned json data. Line 14 won't work for me. Any selectors I try on the returned json data won't work. The selectors still work on items that were there before the json data was returned.
View 1 Replies
View Related
Mar 26, 2010
I am developing a jQuery application and I need to get a parameter from one getJSON request, then use it in another.
Here's a code example that of course is not working:
var ipAddr;
jQuery(function() {
// request IP address
$.getJSON("http://jsonip.appspot.com?callback=?", function(data) {
[Code].....
I know that getting IP address is very easy using PHP or other server side scripting language but I am bound on using HTML and jQuery only.
View 2 Replies
View Related
Apr 2, 2010
Recently i tried to use getJSON to retrieve data from [url] and every time i tested in firefox, the console will always give me error on the line $.each(data.results, function(i,result) saying data is null. i am wondering how to solve this problem?
View 2 Replies
View Related
Apr 6, 2011
below are my code
$.getJSON("http://mydomain.com/phptest.php?jsoncallback=?",function(data)
{
alert(data.a);
});
phptest.php echos out the following
{"a":"hello world"}
Yet, when i made the json calls(cross domain), it just return me nothing. However, under the same domain, I got the pop-up alert and return me the relevant data. But getJSON is suppose to be feasible across all domains irrespective of the same-origin policy.
View 3 Replies
View Related
Oct 5, 2011
Relatively new to jQuery but have a problem with getting data to display.Using a webform with 2 forms. User slects and inputs data into the first form, clicks a button then using jQuery .ajax submits the serialized data to a php script. The script processes the input into multiple paragraphs of text which is based on the input from the first form.The data is returned to the webpage and displayed in a text area (of the 2nd form) where the user can edit it to fine tune the wording. The 2 forms are displayed in different tabs so it is easy to move back and forward between the 2 forms.
The problem occurs when the user goes back to the first form and enters or selects different text and then click the submit button to generate a whole new text for insertion into the textarea on the second form. For certain fields the modified text is displayed.However if the whole of the text in the textarea is deleted, then the user clicks the submit button to re-generate the text content area then nothing at all is ever interted into the textarea. If have user alert to check that data is returned from the php handler and this text is correct. BUT when I click on the tab to see the textarea (id is "draftrec") there is no text inserted. The relevant function is below and the line that should insert the text into the textarea is:
$("textarea#draftrec").html(data).show();
//------------------------------------------------------
$("form#form1").submit(function(e){
[code]....
View 1 Replies
View Related
Oct 10, 2010
I'm trying to display data from mysql database using getJSON
this is the code JQuery Code
Code:
//get data from database
$.getJSON('getCategories.php', parseCat);
// display data
[Code]....
View 2 Replies
View Related
Nov 12, 2011
I am trying to replace the names of each link in my html page with $f1 (Page) and replace some content with $f2 (Description).
How would I insert the data from this php file into my html page?
output.php:
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM Pages";
$result=mysql_query($query);
[Code].....
View 1 Replies
View Related
Jun 3, 2010
I am currently using $.ajax to post to a Perl file that queries a webservice and returns XML. Running the Perl via command line confirms that XML is being returned with Content-Type: application/xml. However, regardless if I set the dataType parameter to "xml", "XML" or just use jQuery's intelligent guess, it appears that I am not getting any data returned to my function at all.
I've tried using the full $.ajax notation and the simplified $.get notation as follows:
and:
I have also tried using JQuery to perform a "GET" directly to the webservice which returns XML by default and still I get no data returned to my function.
Although I doubt it's browser-related, I have confirmed this in both Chrome (5.0.375) and Firefox (3.6.3).
View 1 Replies
View Related
Oct 25, 2009
JQuery seems to be giving an error when trying to pass an alphanumeric parameter like so:
[Code]...
when the above method is called, the error callback is called. However when I change the eventID parameter to a purely numeric value, it works fine and the success callback is called. I would like to pass an alphanumeric value to a server method and this doesnt seem to work.
View 2 Replies
View Related
Aug 10, 2010
I call a query, get success, but don't know how to get the data out. Here is the code..
[Code]...
An object is returned, but I can't the data out of it.
View 9 Replies
View Related
Jul 12, 2011
I'm using Ajax to load some HTML data from an external file. How could you limit the word count to 20 words?
View 1 Replies
View Related
Apr 18, 2010
The server i'm trying to post data to in an ajax call expects data in xml format, including a particular attribute value. I have to use Chrome browser which does not support the XML Class (e4x).
I tried to marshal my data as follows:
But the ajax call does not appear to transfer the xml data to the server even though the xmlhttprequest call appears ok in Chrome's developer tool console.
I'm wondering whether I'm forming the xml formatted data correctly.
View 2 Replies
View Related
Feb 7, 2011
I am creating a page that loads new content via ajax, but i need to execute a javascript function based on the content. ex
<div id='content'>
<script type='text/javascript'>
function newFunction(){
[code].....
View 2 Replies
View Related
Apr 29, 2010
I'm having a little problem with a jQuery/JS script I just wrote in IE7/8. The problem is the first 2 lines of the returned data are not being displayed (w or wo styling) but only in IE. The strange thing is though if I alert the returned data it's there.
The code can be found at [url]
View 1 Replies
View Related
Apr 18, 2011
I am trying to figure out how to pass the html back from an ajax call
Let me give a couple snippets
jquery call:
View 2 Replies
View Related
Mar 14, 2011
I have a web service that returns an array.
Code is below: Data variable comes back as blank. I was wonder is that because the method returns an object or am I doing something wrong on my end.
$.ajax({
View 7 Replies
View Related
May 3, 2010
i have a web service at this url http:[url]....i use hotel search file with HotelSearch method and method will retrieve xml file contains the matched data. the varialbe that i made post with it is named : HotelData
the data of the variable is a string file that contains an xml data like this
<HotelsParameters>
<CityID>388</CityID>
<UserName>admin</UserName>[code]....
the data in input filed is the previous xml file
View 4 Replies
View Related
Mar 23, 2011
How to send data from a text feild in GET method using an AJAX call...
I already have codes working:
Here the variable name may have "me&you" or "me you" like that.... so how do i encode it so that it reaches properly?
View 1 Replies
View Related