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 9162695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:16:20+00:00 2026-06-17T14:16:20+00:00

On a Jquery Mobile content of a page I have an img src like

  • 0

On a Jquery Mobile content of a page I have an img src like this:

<img id="map" src="https://maps.googleapis.com/maps/api/staticmap?center=Madison, WI&amp;zoom=14&amp;size=288x200&amp;markers=Madison, WI&amp;sensor=false" height="200" width="288" />

I have a button and code to change the SRC of the above IMG in a javascript

<script type="text/javascript">
        function update()
        {
            cval = '"https://maps.googleapis.com/maps/api/staticmap?center=Brisbane&amp;zoom=14&amp;size=288x200&amp;markers=Brisbane&amp;sensor=false"'
            $('#map').attr('src',cval);

        }
    </script>

The page loads fine and displays the map image. But when I call the script from a button, I get an error and the image dows not display. Looking in the Chrome Inspect Elements, the first call is to a GET and the image loads, but the 2nd call is also a GET but does not work and the error is “forbidden”

I am trying to make a mobile page so that when the user enters a new location and clicks Refresh, I want to update the IMG to the new location, but this gives me an error.

So what is wrong here? Why does the first GET work but not the 2nd and how to get this to work?

Also just pasting the url in a browser also does not work.

  • 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-17T14:16:21+00:00Added an answer on June 17, 2026 at 2:16 pm

    I got around it by making a new <img>, rather than just switching the src attribute.

    http://jsfiddle.net/lollero/VKAW9/1

    HTML:

    <img id="map" src="https://maps.googleapis.com/maps/api/staticmap?center=Madison, WI&amp;zoom=14&amp;size=288x200&amp;markers=Madison, WI&amp;sensor=false" height="200" width="288" />
    

    jQuery:

    $('html').on("click", function() {
    
        var map = $('#map'),
           cval = 'https://maps.googleapis.com/maps/api/staticmap?center=Brisbane&amp;zoom=14&amp;size=288x200&amp;markers=Brisbane&amp;sensor=false';
    
        $('<img id="map" height="200" width="288" src="'+ cval +'">').insertAfter( map );
        map.remove();
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JQuery Mobile app. This app has a page with a select
I would like create a tabbed mobile page using jQuery Mobile. I have got
I am new to jquery mobile, and am having problems getting content I have
I am developing a site for mob using jquery mobile. I have a content
I have a page in JQuery mobile, which contains a form. The form has
I have created a list in jquery mobile which directs to some page on
I have added an iframe to a JQuery Mobile page: The link to it:
I have a single html page that I'm using jquery mobile on to create
I have a html jquery mobile multi-page and using swipeleft and swiperight events to
I'm trying to display a Google Map on a JQuery Mobile page, but am

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.