Solved

ajax issue

Posted on 2013-12-12
9
336 Views
Last Modified: 2013-12-13
I have a html doc that allows you to click the game you want which directs you to a frames aspx page. The latest component I'm having a issue with. You can load a xml file statically and that works great and everything is wonderful. Cause this control kicks ass but if you

try this
function getData() {
      var xmlPath = 'xml/nhl/scores/real';
var xmlGameID = QueryString.gameID;
      $.ajax({ url: xmlPath +"/"+xmlGameID+".xml"}).done(processGame);
}

You get nothing I noticed in Fire Bug switching from two sports NBA and NHL WELL THEY BOTH WORK IN SIMILAR FASHION. Broken NHL HAS  red text dev.sportsnetwork.com/aspdata/nhl2/xml/nhl/scores/real/18011.xml

the aspdata/nhl2 gets added.

while basketball has a black text dev.sportsnetwork.com/xml/nhl/scores/real/18011.xml

so I tried

function getData() {
	 var xmlPath = '/xml/nhl/scores/real';
                var xmlGameID = QueryString.gameID;
	 
	 $.ajaxSetup({ cache: false });
                $.ajax({
                    type: "GET",
                    url: xmlPath +"/"+xmlGameID+".xml",
                    dataType: "xml",
					 success: function(data){
                         var d = $(data);
						 processGame();
      if (d.find('Play').attr("Status").toUpperCase() === "FINAL") {
        clearInterval(myVar);
	  }
					 }
	  });
	 
	  }
	  

Open in new window

 and A few more to realize you as in me need help. I'm sorry if it's hard to explain
But it's passing game Id in browser line then page grabbing it and load xml information.

EE HELP THIS IF WORKING IS A KICK ASS CONTROL. CHRIS
Dropdown2.html
players.js
0
Comment
Question by:powerztom
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 43

Assisted Solution

by:Chris Stanyon
Chris Stanyon earned 500 total points
ID: 39714619
Hey Tom,

It's because of a leading forward slash in your path name - without it, your script will look in the current folder. With it, it will look to the root of your website.

If you set you path to this:

var xmlPath = '/xml/nhl/scores/real';

Then it will add that to your domain name and look here:

yourDomain.com/xml/nhl/scores/real

If you set it like this:

var xmlPath = 'xml/nhl/scores/real';

then it will add it to the folder you are currently in, so if your page is in a folder called aspdata/nhl2 then it will look in :

yourDomain.com/aspdata/nhl2/xml/nhl/scores/real
0
 
LVL 43

Accepted Solution

by:
Chris Stanyon earned 500 total points
ID: 39714689
FYI - That code is never going to work properly, even if it finds the correct XML data file. The processGame() function expects a parameter - it needs the game data passing to it, so you should call it like this:

processGame(data);
0
 

Author Closing Comment

by:powerztom
ID: 39714925
Thanks again my friend the only thing I realized is that IFRAMES don't work with dropdowns so if you drop down your selection is ignored. Unless you know of some magic. Thanks Chris for explaining the differences with the slashes and also adding the parameter data after ProcessGame I love this site you learn from all stars I keep saying I'm the only programmer at my job and I really did desktop engineering VB6 VB.NET and now I have no colleagues to ask questions. My friends aren't into computers So the site and guys like you are saviors. I wish I was in England and drinking yards with you. Have a Great Weekend.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 43

Expert Comment

by:Chris Stanyon
ID: 39714948
No worries Tom,

Pleased it's working. The dropdown should work in iFrames as the content of an iFrame is just an HTML page - without seeing how you've implemented it I can't really help you out. If you want me to take a look, post a link to your page...
0
 

Author Comment

by:powerztom
ID: 39714993
OK Chris I put hockey in the public area

http://sportsnetwork.com/gamecast/nhl2/dailynhl.html


in case you have problems
http://sportsnetwork.com/gamecast/nhl2/NhlIframe.aspx?gameID=18063

It's a rough version it will look better after graphics department handles this.



Rob what about having one button and it's job is two process both dropdown values? That wouldn't be soo bad would it ?
0
 
LVL 43

Expert Comment

by:Chris Stanyon
ID: 39715364
Can't connect to the nhliframe page!!
0
 

Author Comment

by:powerztom
ID: 39716995
MY boss is Rob there's a Rob on EE sorry calling you Rob. I gotta proof read. The sports network site has http://www.sportsnetwork.com/merge/tsnform.aspx? any aspx pages have to have this PRETEXT before it. I didn't know it yesterday I thought I found a way around for the outside world to avoid using that pretext to view a aspx page but you proved me wrong only html pages can be viewed


but this is the aspx page probably won't help but with a guy like you you never know

<%@ Page language="vb" EnableSessionState="false" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>The Sports Network 2014 NHL Gamecast</title>
</head>
<script language="VB" runat="server" >
    Dim MYID As String = "OK"


Sub Page_Load(Source As Object, E As EventArgs)
       
   

   

        MYID = Request.QueryString("gameID")
        
End Sub
</script>
<body bgcolor="#000000">
    <form id="form1" runat="server">
    <div>
    <body>
<table width="784" border="0" class="tableborder">
  <tr>
    <td width="685"><iframe width='780x' height='225' scrolling='no' frameborder='no' src='http://dev.sportsnetwork.com/aspdata/NHL2/ScoreBoard4.html?gameID=<%= MYID %>'></iframe></td>
  </tr>
</table>
<table width="783" border="0">
  <tr>
    <td width="400"><p class="topmid"><iframe width='390
          ' height='520'
          scrolling='no' frameborder='no' src='http://dev.sportsnetwork.com/aspdata/NHL2/Roster.html?gameID=<%= MYID %>'></iframe>
      <iframe width='400
          ' height='300' scrolling='no' frameborder='no' src='http://dev.sportsnetwork.com/aspdata/NHL2/GOALIES.html?gameID=<%= MYID %>'></iframe>
    </p></td>
    <td width="383" class="topmid"><p>
    <iframe width='400
          ' height='315' scrolling='no' frameborder='no' src='http://dev.sportsnetwork.com/aspdata/NHL2/RinkV.html?gameID=<%= MYID %>'></iframe>
   </p>
   <iframe width='425
          ' height='500' scrolling='no' frameborder='no' src='http://dev.sportsnetwork.com/aspdata/NHL2/dropdown2.html?gameID=<%= MYID %>'></iframe>
   </td>
  </tr>
</table>
    </div>
    </form>
</body>
</html>

Open in new window

0
 

Author Comment

by:powerztom
ID: 39717159
And the links are all to the development server. I created a image and using it as a button an first I put it  like this btngo is image button I thought it's go  practice to put button clicks inside doc ready function. Now I know that that will not work

$(document).ready(function() {
      
      getData();
      $('#filterPeriod, #filterAction').change(applyFilter);
      $('#btngo').click(function(){
      applyFilter();
     
   });
});

Now I know that that will not work cause I put this inside and outside of doc load function

$('#btngo').click(function(){
       alert("message");
     
   });
Just a simple message box so what's up and appyfilter is that the function that will take both values from the two dropdowns.

Chris I'm using IFrames to keep from having huge chunk of code do you think that is wise or have everything on the page which would be alot to troubleshoot. What's your opinion?
0
 

Author Comment

by:powerztom
ID: 39717754
Chris,

I tried to use your code for a QB Ranking xml file with a scroll. I'm sure it something simple cause I followed every detail.
http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28317959.html
0

Featured Post

More Than Just A Video Library

Train for your certification. Learn the latest DevOps tools. Grow your skillset to do better work.

At Linux Academy, we release new training modules every week so you'll always be up to date on the latest tech.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question