Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8882331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:33:05+00:00 2026-06-14T20:33:05+00:00

Fiddle: http://jsfiddle.net/gpTpK/ The issue I am having is that the title variable is not

  • 0

Fiddle: http://jsfiddle.net/gpTpK/

The issue I am having is that the title variable is not updated/changed when the $.ajax is executed, I know that the ajax call is working as I have tried replacing the line

title = $(xml).find("title").text();

with

console.log($(xml).find("title").text());

and sure enough it does return the title however when using the orginal line the variable title doesn’t change

I have tried and it does work putting the ajax call outside (function($){})(jQuery);

(function($) {
    $.fn.getPost = function(options) {
        var $this = $(this);
        var defaults = {
            method: "html",
            blogID: "",
            postID: "",
            done: null
        };
        var options = $.extend(defaults, options);
        var title;
        $.ajax({
            type: "GET",
            url: "http://www.blogger.com/feeds/724793682641096478/posts/default/3551136550258768001",
            dataType: "xml",
            dataType: 'jsonp',
            success: function(xml) {
                title = $(xml).find("title").text();
            }
        });
        return $this.each(function() {
            if (options.done) {
                options.done.call(undefined, title);
            }
        });
    };
})(jQuery);

I have tried the below and i have also tried wrapping the ajax in a function such as getTitle(){ajax code here with return title;}

(function($) {
    $.fn.getPost = function(options) {
        var $this = $(this);
        var defaults = {
            method: "html",
            blogID: "",
            postID: "",
            done: null
        };
        var options = $.extend(defaults, options);
        var title;
        getAjax();
        return $this.each(function() {
            if (options.done) {
                options.done.call(undefined, title);
            }
        });

        function getAjax() {
            $.ajax({
                type: "GET",
                url: "http://www.blogger.com/feeds/724793682641096478/posts/default/3551136550258768001",
                dataType: "xml",
                dataType: 'jsonp',
                async: false,
                success: function(xml) {
                    title = $(xml).find("title").text();
                }
            });
        }
    };
})(jQuery);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T20:33:07+00:00Added an answer on June 14, 2026 at 8:33 pm

    sorry, I have spent ages trying to figure it (I didn’t ask out of laziness :P), regardless here’s the solution for those interested 🙂

    (function($) {
        $.fn.getPost = function(options) {
            var $this = $(this);
            var defaults = {
                method: "html",
                done: null
            };
            var options = $.extend(defaults, options);
            var title;
            var sorf;
            $.ajax({
                type: "GET",
                url: "http://www.blogger.com/feeds/724793682641096478/posts/default/3551136550258768001",
                dataType: "xml",
                dataType: 'jsonp',
                success: function(xml) {
                    title = $(xml).find("title").text();
                    sorf = 1;
                },
                error: function(){
                    sorf = 0;
                },
                complete: function() {
                    returnvals(sorf);
                }
            });
    
            function returnvals(sorf) {
             if(sorf){
             //success
                return $this.each(function() {
                    if (options.done) {
                        options.done.call(undefined, title);
                    }
                });
             }else{// failure}
            }
        };
    })(jQuery);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In this fiddle http://jsfiddle.net/dAHqe/2/ I've created examples for the 2 main uses (that I've
I have this fiddle : http://jsfiddle.net/XjeCf/1/ that works like I want and this one
Here's my fiddle : http://jsfiddle.net/JWww3/ I'm not sure to understand why this code is
This fiddle http://jsfiddle.net/paultrotter50/fdvC5/ shows the problem I am having with detecting the height of
Ive that small Fiddle http://jsfiddle.net/5XXdJ/ <img src=http://placehold.it/333/fe3/img/picture2.jpg id=bg /><br /> <a href= title=Switch class=menulink>DE</a>
http://jsfiddle.net/9aaNh/ Please check this Fiddle. I am having problem with spacing in between text
I made this short fiddle: http://jsfiddle.net/NZnN2/ . Why is it not popping up the
Here's my current fiddle: http://jsfiddle.net/UjAQf/79/ My target table design is this: But I'm having
I have this fiddle: http://jsfiddle.net/gY2JV/63/ How come the data is not showing?
Fiddle: http://jsfiddle.net/MhWm5/16/ I have some dynamically generated table rows/values with dynamic IDs <td class=control-group>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.