sry about the format, i ll paste it again and make it easy to read.
PS: i think i know why it isn't working, i suspect after the success
ajax call, the page has already been loaded, and append
script to flash div didn't actually run the script. now i am
wondering, is it possible to get some script from server response and
execute the script after the page has been loaded?? any help will be
appreciated.

<code>
               /*****in page header********/
              var flashHTML;
              $.ajax({
                  url: "crossdomainURL",
                  data: { 'ClientID': '100', 'CatID': '11',
'LessonID': null, 'ClientUserID': null },
                  contentType: "application/json; charset=utf-8",
                  dataType: "jsonp",
                  success: function(data, textStatus) {
                      //alert(data);
                      //alert(data.d);    //NOTE: i can get the return
data here.
                      //alert(JSON.stringify(data));
                      flashHTML = data.d;
                      //$("#flash").append(flashHTML);  //Note: if I
uncomment this line here, the html part of the flashHTML
                                                                      //
will be shown on the page but the script will not excute.
                  },
                  error: function(err) {
                      alert("errr");
                  }
              });
              /*****in page body********/
              <body >
              <form id="form1" runat="server">
              <div id="flash"></div>
              <script language="javascript" type="text/javascript">
              setTimeout("showFlash()", 500);    // Setup a time
delay, because the flashHTML is obtained from an ajax call, it will
NOT
                                                                // be
rdy without the delay.
              function showFlash() {
                  $("#flash").append(flashHTML);   // If i append the
flashHTML here, the script inside the flashHTML will be excuted.
                                                                 // if
i comment this out and put it inside the success function of the ajax
call, it doesn't
                                                                 //
work.
              }
              </script>
             </form>
             </body>
</code>

Reply via email to