Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 339
  • Last Modified:

ajax issue

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
powerztom
Asked:
powerztom
  • 5
  • 4
2 Solutions
 
Chris StanyonCommented:
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
 
Chris StanyonCommented:
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
 
powerztomAuthor Commented:
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!

 
Chris StanyonCommented:
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
 
powerztomAuthor Commented:
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
 
Chris StanyonCommented:
Can't connect to the nhliframe page!!
0
 
powerztomAuthor Commented:
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
 
powerztomAuthor Commented:
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
 
powerztomAuthor Commented:
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

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!

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now