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

  • SEARCH
  • Home
  • 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 7717109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:48:08+00:00 2026-06-01T02:48:08+00:00

Yes I know, this title isn’t really helpfull but this is the exact problem.

  • 0

Yes I know, this title isn’t really helpfull but this is the exact problem. For some reason (I don’t know), I can’t manipulate my HTML in the beforeSend Function of my AJAX-Request.

This is the HTML:

<div class="right">
    <span id="observer-eye" original-title="Observe this Summoner" data-id="2">
        <img alt="" src="/lolreports/img/icons/observer_eye.png">
    </span>
</div>

And this is the AJAX-Request:

$.ajax({
    type: 'post',
    dataType: 'json',
    url: webroot + 'summoners/observe',
    data: 'data[Summoner][id]=' + id,
    beforeSend: function(XMLHttpRequest) {
        $(this).parent().empty();
    },
    success: function(data) {
        if(data.status == 'success') {
            $(this).find('img').attr("src", webroot + 'img/icons/observed_eye.png"');
        }
    }
});

My goal is to put an ajax-loader.gif inside the -Tag which I wanted to do with $(this).find(‘img’).attr(“src”, webroot + ‘img/icons/ajax-loader.gif”‘); – Nothing happened. I tested many ways to manipulate the image or the span, but nothing happens. I wondered if beforeSend gets ever executed, which I tested with an alert(). It worked. But no DOM manipulation.

I have no idea where to search, I hope you can help me.

  • 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-01T02:48:09+00:00Added an answer on June 1, 2026 at 2:48 am

    Don’t use $(this) as it doesn’t rightly reference your intended element. There are of course many ways to do this, try this

    $("#observer-eye").find('img').attr("src", webroot + 'img/icons/observed_eye.png"');
    

    For the beforesend, don’t use $(this), do this instead

    $('the-intended-selector').parent.empty()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First, yes I know about this question , but I'm looking for a bit
I know the Sales pitch answer is yes to this question, but is it
I can't find a straightforward yes or no answer to this! I know I
(Yes I know I can call Java code from Scala; but that is pointless;
Yes, the title is confusing, but I will keep this simple. Imagine a photo
How can we set the button title for a button,i know this answer its
The title may sound confusing but it actually isn't, I just didn't know how
I'm working with a large (270+ project) VS.Net solution. Yes, I know this is
I'm trying to get regexp to match some nested tags. (Yes I know I
I know this question will sound like a from the past thing but I

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.