Tag: ajax

Running a PHP through Ajax on Unload

I’m trying to have a php script run when the user navigates away from the page. This is what I’m using currently: function unload(){ var ajaxRequest; // The variable that makes Ajax possible! try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ ajaxRequest = new ActiveXObject(“Msxml2.XMLHTTP”); […]

How to clear the value of a javascript variable?

I am using a javascript var to control the running of an ajax call. The call is triggered from a click event (on “#week_tag” div)and only needs to be run once per page load. The same click event also toggles the display of the sliding pane (“#week_summary”) where the data from the ajax call is […]

jQuery .load seems to be running at an unexpected point

So I’m trying to load some returned html from an .aspx page but a click event needs to fire before it doing some stuff that the AJAX request depends upon. More specifically, I’m doing this. When a user types in a text field this function is run… function KeyPress() { $(“#” + HiddenButtonId).click(); $(“#test”).load(“TempJumpToAJAX.aspx”); } […]

Zend_Form Jquery & fileUploadErrorIniSize

Edit, I fixed it by changing my JS to: $(‘.zend_form input:not([type=”file”]), .zend_form textarea’).each(function() { data[$(this).attr(‘name’)] = $(this).val(); }); Hello, As I posted earlier, I followed a ZendCast that allowed you to use jQuery to detect and display to users problem with their form. However, file fields always return: fileUploadErrorIniSize (File ‘image_front_url’ exceeds the defined ini […]

Javascript: how to post the whole page?

Is it possible to post the whole html page to the server(assuming that the server can handle it)? I’m trying to implement the following setup. The user makes some changes(the user selects some text, and this text is wrapped in <span> tags with some class) to html and submits the page. The server extracts some […]

Why would PHP-generated Javascript not work in file loaded via AJAX?

I am loading a .php file via an ExtJS AJAX call like this: menuItemApplication.header.on(‘click’, function() { Ext.Ajax.request({ url: ‘content/view_application.php’, success: function(objServerResponse) { var responseText = objServerResponse.responseText; regionContent.update(responseText); var scripts, scriptsFinder=/<script[^>]*>([\s\S]+)<\/script>/gi; while(scripts=scriptsFinder.exec(responseText)) { eval(scripts[1]); } } }); }); Javascript in the loaded .php file executes fine: <script type=”text/javascript”> regionContent.update(‘changed region content from within application view’); </script> […]

Browser crashes after 10-15 mins

In my app I’m displaying 10 charts (charts are from dygraphs.) to monitor data. For displaying charts I’m getting data from my sever by sending ajax request to 4 servlets on every 5 seconds. After 10-15 mins (don’t know exact time.) my browser crashes saying “aw!! snap.” What could be the reason? Is it javascript […]

Ajax inserted content not accesible in DOM

I am working on a pure jquery/js site, mostly to practice some jquery. I am using a load statement to load a menu from a file of common html, like so: $(‘#categoryListing’).load(‘../common.html #categoryLinksUL’); which loads: <ul id=”categoryLinksUL”> <li><a href=”#anklets” rel=”ajax”>Anklets</a></li> <li><a href=”#bracelets” rel=”ajax”>Bracelets</a></li> </ul> The problem is where I am using it now I need […]

Having trouble getting jQuery AJAX response headers

This is what I’m trying: $.ajax({ type: ‘GET’, url: ‘http://imgur.com/upload/’, data: { url: ‘http://upload.wikimedia.org/wikipedia/commons/3/3e/Phalaenopsis_JPEG.png’ }, complete: function(jqXHR, textStatus) { console.log(jqXHR.getAllResponseHeaders()); } }); I just get an empty string. Any help would be appreciated. Edit: These are the response headers I can see in Firebug: Server: nginx Date: Sat, 02 Jul 2011 03:04:26 GMT Content-Type: text/html; […]

Override Ajax Success event

I am trying to override the jQuery ajax function to handle a default action on a success event but also executing the callback function that i am using in the options parameter. What the purpose is there is tags returning in the response that I always want to strip out of the response for use […]