ajax

How to return the result from JSONP call outside the function?

I have the following function which works great, i used JSONP to overcome cross-domain, wrote an http module to alter the content-type and didn't append a callback name in the url. function AddSecurityCode(securityCode, token) { var res=0; $.ajax({ url: "http://localhost:4000/External.asmx/AddSecurityCode", data: { securityCode: JSO...

How to do long-polling AJAX requests in ASP.NET MVC?

Does anyone know how to code up long-polling AJAX requests (for server PUSH notifications) in ASP.NET MVC? Whenever I do it, it seems that only the last browser to open up a window gets the notifications. As if IIS/ASP.NET were canceling the last request because it was hung or something. ...

Send JSON with AJAX

Is there anything special I have to do to a JSON object before I send it with AJAX? My code looks like this: runAjax(JSON.stringify(data)); } function runAjax(JSONstring) { ajax = getHTTPObject(); var params = "?data=" + JSONstring; ajax.open("POST", "createtrip.php", true); ajax.setRequestHeader("Content-type", "app...

Positioning ModalPopupExtender above another ModalPopupExtender.

The first ModalPopupExtender appears in the center of the screen, when i show the second ModalPopupExtender it appears bellow and to the right of the first one (though above the first one). I want to place it in the center of the screen. Update: I found that the problem with second popup was: PopupDragHandleControlID="pnlDragMe" i...

Make .cfm template accessible only via ajax call?

I have a template set up that I'm making ajax calls to via jQuery. I'm passing a URL parameter called "method" and then doing a <cfswitch> through each method to determine what block of code to execute. Problem is, I don't want this page to be accessible outside of the ajax call. In other words, I don't want the template to run if someo...

javascript and ajax load, then effects

Hi, I have a javascript code, whereby I'm trying to load a list from a separate page (using jQuery's load() function), slide the current list out and slide the new list in. Now, I don't want the old list to slide until after the new list has been completely loaded. Can anyone tell me how to achieve this without looking like the script i...

Fetch information from database with ajax until it becomes right

Hello, I'm making this game where I'm trying to "pair people". So I have this database where I add people when they want to join a game. And when two people want to join a game, I redirect them to the game. But I wanted to make this in ajax (which I'm a new to), so that it continually looks at the database if a new person has joined. I ...

Ajax Call to Monorail Controller JQuery

I could really use an example of this. Can anyone provide me with a sample implementation of a Javascript function using JQuery (not totally necessary) to make a Castle Monorail call? I have Monorail configured to intercept all HttpRequests with "*.ashx". Using an Ajax call I would like to pass a parameter to my Monorail Controller and ...

Creating a "Breaking News" div with ajax if file exists?

I'm wondering if there's a way to create a breaking news div that can appear even if a file exists on the server and even if a dynamic page has been statically saved for caching purposes. E.g. every page (dynamic/static) has an empty with an id: <div id="breaking"></div> Is there a way, as the page loads, to have ajax check if a fil...

Ajax returned text read differently by Firefox and IE

I am returning a json object that Firefox reads correctly but IE doesnt. for example: if( data.returnedText=="OptionA"){... this is true as it should be in Firefox, but IE doesnt match. ...

A good way to send complex objects with ajax?

In my web app, I have some complex objects written with JavaScript (ie nested arrays, objects within objects withing objects, etc) and the nature of my app relies on these. I need to send all the data to PHP so that I can save it to the database. What is an efficient, easy way to send my objects to PHP? I tried JSON, but got strange erro...

Developing a rich internet application

Hello, I have been a desktop developer for a few years mostly doing object oriented stuff. I am trying to branch out into web development, and as a hobby project trying to put a web application together. I have been reading quite alot of information, but I still can't seem to decide on the path to take and would really like some advice....

Max length of query string in an AJAX GET request?

Is there/what is the maximum length of the query string when doing an AJAX GET request? More specifically, I am doing cross-domain AJAX using an image: img = new Image(); img.src = "http://www.otherdomain.com/something.gif?long_query_string=long........"; What is the limit on the query string here? ...

Measure client upstream bandwidth using ajax

In my struggles to make our customer's experience of our web services as good as possible I am creating a webpage where the individual customer can measure their latency and bandwidth to our site. Not really a hard task but I need some feedback on how to efficiently measure client upload bandwidth. Anyone got an exmample/hint on how to...

Securize a web-app with the mac adress

I'd like to know if it's possible to get the mac adress of a client with a javascript, It would be a good way to securise web-app. (eg. Limit one license p/ Mac Adress) ...

jqmodal window closes on form submit for all browsers except FF

I have a comment window that opens up in a small jqmodal window. I am trying to use $.ajax to submit the form and show "success" in the small modal window. but in all browsers except firefox, the modal closes when I submit the form. <script type="text/javascript"> $().ready(function() { $('.reportForm').submit( function(){ if (docum...

ASP.net MVC AntiForgeryToken over AJAX

I am currently developing an MVC application in ASP.net. I am using AJAX.ActionLink to provide a delete link in a list of records, however this is very insecure. I have put this: <AcceptVerbs(HttpVerbs.Post)> Over the function to do the deleting, which stops the function being called simply by a URL. However, the other security hole t...

How to close the popup in jquery

I created a Popup in jquery. When mail icon is clicked it will open a popup which contains Enter email - label Email -text box Send - Button close - button When another icon called print icon is clicked it will open another popup with confirmation message "Are you sure u want to print" with Yes, No button. When print icon is clicked...

Can dynamically loaded JavaScript be unloaded?

I am writing a web application that has a static outer "shell" and a dynamic content section. The dynamic content section has many updates as users navigate the system. When a new content block is loaded, it may also optionally load another JavaScript file. In the name of good housekeeping, I remove script blocks from the DOM that app...

jQuery: Loading an external page using AJAX, then calling insertAfter() into table row

I'm trying to load some content into a table using insertAfter(), but the content I'm trying to load is html (output from an asp.net page) that I'm getting using AJAX.Load(). From my understanding, insertAfter() works like this: $("htmlcodehere").insertAfter("selector"). AJAX.Load() works like this: $("selector").load("Html/file"). ...