0

I try to load image from other site by using query and replace it in div

MY HTML:
<div id="img_30"></div>
<div id="img_120"></div>
<div id="img_day"></div>
<div id="img_week"></div>
<div id="img_month"></div>

-

JQUERY:

var symbol = $("#stock").val();
symbol = symbol.concat('*BK')
$("#show_symbol").html(text_value);

$("#img_30").html( "<img src='dummy.png'>" );
$("#img_120").html( "<img src='dummy.png'>" );
$("#img_day").html( "<img src='dummy.png'>" );
$("#img_week").html( "<img src='dummy.png'>" );
$("#img_month").html( "<img src='dummy.png'>" );

site and parameters (example):

http://www.chartty.com/investorzChart.php?symbolnsources=symbol&period=Monthly&interval=1&Cycle=MONTH1

so my jQuery.post() it should be look like:

$.post( "http://www.chartty.com/investorzChart.php", 
{ symbolnsources: "symbolnsources", 
  period: "monthly",
  interval:"1",
  Cycle:"MONTH1",
 })
.done(function( data ) {
alert( "Data Loaded: " + data );
});

or not.

Thank you.

YONG BAGJNS
  • 501
  • 2
  • 8
  • 21

1 Answers1

0

If the data is being appended to the url you need a get request, also drop the additional comma at the end of your passed up data after Cylcle:

$.get("http://www.chartty.com/investorzChart.php", {
  symbolnsources: "symbolnsources", 
  period: "monthly",
  interval:"1",
  Cycle:"MONTH1"
}).done(function(data){
  //load the data into your site unfortunately the link provided is down so I can't see the data format returned
});

This answer is assuming CORS is enabled.