Javascript - JQuery Ajax Url Path Breaks When Accessed In Different Directory Levels?
Oct 15, 2010
Its time for another very simple question that I can't find an elegant solution for. Basically, I have an app that is using a jQuery Ajax call. In this call, you have to specify a URL path for the service that you are calling. In this instance, I am needing to call this JavaScript function from multiple files in my application and those files are on differing levels of the folder structure.
Here's the question, how would you elegantly handle this scenario so that you can call the JS function from any location in your app. Here are my constraints:
1) I am running on Asp.Net 4.0.
2) My current environment has a local, Dev, Test, and Prod Environment (hard-coding the URL path will not work).
The IDs for the 'pane' divs are GUIDs of domain objects in a database. Everything works as it should. But when I include the cookie option in the function call on
$(document).ready(function () { //$("#tabs").tabs(); //Without tabs works fine $("#tabs").tabs({ //This call with cookie option breaks everything. cookie: { expires: 1 } }); });
By 'breaks' I mean - the contents of my final tab (which includes a 'submit' button) ends up being displayed at the bottom of every tabbed page although the tab itself looks fine. None of the tabs open the corresponding pane when clicked, but I can see the correct tab id in the address bar on the browser when I click a tab. I've compared the source of both pages (with and without the cookie option) and they are identical apart from the call to the JQuery tab function. But the Javascript console reports an error: cannot call method 'apply' of undefined
Is there something else I need to do to get this to work? The documentation suggests not. I've inluded the cookies plugin as suggested by Nalum, but this hasn't solved the problem. Drilling into jquery-ui-1.8.9.custom.min.js gets me the offending bit of code:
This code seems to be expecting [b] to be something like ui-tabs-1 which is the way in which the tabs are IDed if you add tabs via the tabs.add(...) function. And of course I don't add my tabs this way - all my tabs have GUID IDs which are related to elements which come from a DB and are output by a Repeater control. Some HTML below for reference:
<div id="tabs"> <ul> <li> <a href='#TabDiv471de30d-aaec-4485-8a50-1b2fdbc58053'> Tab A </a> </li> <li> <a href='#TabDiv951e2fee-9272-4a8c-becb-3f3a07770347'> Tab B </a> </li> </ul> <div id='TabDiv471de30d-aaec-4485-8a50-1b2fdbc58053'> This is Pane A </div> <div id='TabDiv951e2fee-9272-4a8c-becb-3f3a07770347'> This is Pane B </div> </div>
I am new buddy to Jquery. I am using a Jquery image scroller in ASP.net.But In this scroller image path must be set in javascript like an array. For Ex-Car_Image_Sources=new Array( imagearray// NOTE No comma after last line
I am building a Web Forms application, it involves a database, so I have some sort of login.
I have put all the webforms to do with Account Login and Update into their own separate folder. The folder is called { Account } in the application root.
My Site.Master is also at the application root, along with other files (e.g. Default.aspx .. etc).
This image file path breaks when I view the pages inside the Account Folder:
[Code]....
I understand why it is happening, but I can't figure out how to avoid this problem, unless I put the Master page along with all the other files into a folder too.
I have a page that shows a list of the files in an upload directory. ie: My customer uploads a file through my web page and the file ends up in the proper directory. When I click on a file name, the url path is missing the directory name. It's as if my customer uploaded directly to my root. Interestingly, when I upload a file through the same web page, the path remains intact and I am able to click on the link and download the file. How can I get the proper path in my url name. Here is my code .
I have a Menu page. If a user selects an Menu Item it opens a new IE Window using JavaScript. So user can open different parts of applications in multiple IE Windows. These Windows have the same Session.
My issue is that these pages are accessed synchronously? If one of the child window is waiting for an action to be finished no other request from any other child window is processed. Is it because of using Session variables?
Update: This is only happening to the windows having the same parent. If I have IE child windows from different parent windows then this issue is not there.
I am doing Ajax call using jQuery and my URL is like
http://localhost;3327/DummyAps/Demo.aspx
In Demo.aspx page i have a WebMethod, which i wanted to call. While doing jQuery ajax call i am giving the URL as "/DemoWebMethod", where "DemoWebMethod" is the Webmethod present in Demo.aspx page.
But while calling the WebMethod it is calling the URL http://localhost;3327/DummyAps/DemoWebMethod but i want to call http://localhost;3327/DummyAps/Demo.aspx/DemoWebMethod.
I know that changing the URL from "/DemoWebMethod" to "Demo.aspx/DemoWebMethod" will solve the problem but can i do it without writing that (because i have some problem with that).
I've searched far and wide, but can't find out why this is happening. I have a clientside javascript ajax call into a web service that works fine if both the service and the calling page are in the same directory. If I try to move the web service to another virtual directory, I get this:
Exception type: InvalidOperationException Exception message: Request format is unrecognized for URL unexpectedly ending in '/js'.
Here are the relevant code tidbits for the separate directories attempt.
aspx file:
[Code]....
CallYahooQuotesServiceMethods.js:
[Code]....
asmx file:
[Code]....
I tried this in my web.config, but it didn't work:
[Code]....
Authentication mode is Windows. If I have to impersonate to do this, I'm not sure how I'd pull it off with Javascript.
I need to perform asp.net web-service function call via jQuery and pass asp.net application path to it. That's the way I'm trying to do it (code is located within asp.net page, e.g. aspx file):
[code]...
Function call works well, but applicationPath parameter doesn't passed correctly. When I debug it I see that backslashes are removed, function gets "C:ProjectsSamplesmytestwebsite" instead of "'C:ProjectsSamplesmytestwebsite'".
which returns <div>here</div><script language=javascript>alert('');</script> The content gets loaded property, but no alert. How would I get a javascript routine to work from an ajax call along with posting the HTML code?
I am trying to create a menu with multiple sub levels
Menu 1 Submenu2 SubMenu22
The values of these menus and the urls are populated from the database. Currently I am using a TreeView to achieve this functionality but looks like treeview has lots of overheads.Could you please help me to construct the same functionlity using the accordian and repeater control
What I have is button that should open another page only if textbox length is 8. Javascript must be added from code because it does not simply calls the bla.aspx, it's more like bla.aspx?id=4&code=234 etc etc...
What happens is that when I click the button page bla.aspx opens, and even postback is trigered. Validator is showing the message, but page is opened and postback trigered.
This is a simplified version of what I want to do. Basically I have a datalist with a bunch of stuff in it and when you mouseover items in the datalist I want jquery to hide/show stuff. The problem is that after I databind my gridview/repeater/datalist jquery quits working if the gridview/repeater/datalist is in an update panel. After you click the button in the sample below, the jquery that makes the span show up when you mouse over quits working. Any ideas of why this is happening, how to fix it or a better way to do this?
The following code is being used to disable a Submit button once it has been clicked. This works great on desktop browsers and most BlackBerry mobile browsers.
when using a BlackBerry Storm clicking the submit button causes the device to just reload the page. If I remove this code the Storm browser submits the page just fine. I need to disable the button when the browser is capable of doing so but do not want to affect browsers that are not JavaScript capable.
My basic question is, can a virtual directory in IIS point to a physical path that's not on the local machine? For instance, right now I have a virtual path /NaturalGasReport/NYMEX which points to physical path C:Program Files (x86)NymexSettleNATGAS_REPORTNYMEX, but I want it to point to a physical path on a difference PC on the same network. Is this possible? (I know I can just try it out so I apologize for asking but I thought it would be best to get an explanation along with "yes" or "no"). If you want more detail, this is what I need to do. To make a long story short, because of a vendor product we are using that won't run on a 64-bit operating system, I have to run a program called Generate_NGReportData.vbs (it's a vbscript program) on a PC I will call 28. It uses a vendor product which produces jpg files which are graphs of the Natural Gas market. The machine where I wish it could run is called RTEST01 but this machine runs a 64-bit OS and the components won't work there. RTEST01 has the databases. So, I created a datasource on 28 which points to RTEST01's database. The vbs program will read the data, generate the reports, and write one row to a database table on RTEST01. RTEST01 has to run the complimentary program which sends these reports (via email). 28 is not an email server so it can't email the reports. So on RTEST01 I will run Send_NaturalGasReport.vbs. This program creates an email body of html. The html references [URL]NaturalGasReport/NYMEX/" & Day(nymex_update_dt) & ".jpg which is a virtual directory pointing to C:Program Files (x86)NymexSettleNATGAS_REPORTNYMEX. I need it to point to the folder and files on 28.So if my initial question has a simple yes answer then I am all set. If not, examine my architecture and propose an alternative solution.
I'm trying to deploy my web project to my local IIS server (C:inetpubwwwrootlunchbox). By default the in is created inside the project directory - i.e lunchboxin. This setup, however, gives me the following error when I try to open the site:
When I move the in directory outside the project root (i.e C:inetpubwwwrootin), the site opens up just fine. I'm also able to test the web project from Visual Studio without any issues.
Can someone tell me why I have to move the in directory outside the project root to make the site work? What can I do to not have to do this?
i have a asp.net web application and i need to take a full Directory path (for ex: http:\<server><websitename>folder1 est.lst) and parse the name of the folder that has test.lst file. The directory tree can vary and i just need a generic way to parse this path and find the directory name which has the file.
I have a page where im listing out the files within a directory. How can i get the path to the files that are listed?
in other words, i want the path to the file to be like this:
http://server.com/files/pdfs/mypdf.pdf
but using this string url = Request.RawUrl.ToString(); returns [ http://server.com/files/pdfs/default.aspxMYPDF.PDF ]
That file is actually within a sub directory of the pdfs folder. So the link is obvisously not correct. Ive tried other suggestions found online, but those return the link like this [ http://server.com/files/pdfs/MYPDF.PDF ] again missing the subdirectory it actually belongs to.
I am wondering if it is possible to create AJAX Toolkit control using JavaScript/JQuery or not. I know that I can create controls at server (at design or code-behind) and interact with its properties using JavaScript but I would rather want to initalize and create controls at client side using JavaScript/JQuery.
To start with then we have a LinkButton whose text is actually an image tag. The image it links to is a Png and resides in a folder in the web directory. This is IIS V6 and win Server 2003.
The path is [URL]
Admin is a virtual directory configured in IIS.
The above url doesn't work but if you change it to [URL] (lowers case 'a') then the image is served, change it back to 'A' and it takes you to login, you log in and it loops back to log in. change to 'a' and voila the image is served. Weirdly this problem doesn't always occur and I have hunted for a resolution for days to no avail.
I am trying to profile the number of "Anonymous Requests" for an ASP.NET web application using perfmon. When I select this key, I have to pick a process of the form _LM_W3SVC_#_ROOT. How do I map the IIS metabase path back to the web application?
I have created a setup for my application which is having both website and desktop application. i m supposed to changes connection string in both the config files at runtime. i used following code :