ajax

jQuery validate form with AJAX

I'm trying to validate a form using an AJAX call to check available inventory. If the inventory check has an error it returns a msg, if not the form should submit. I have the following code: $("form[id*='distributor_']").submit(function(){ return checkAvailableInventory($(this)); }); function checkAvailableInventory(form) { $...

Dynamic image gallery generation using PHP and jQuery

I've got an idea in my head, something I want to create, but am not sure about the best approach. I'd like to pitch the idea and get some opinions on a smart way to go about this before I dive headfirst in the wrong direction! I've got a photography website that displays multiple portfolios for a few different photographers. It's got th...

AJAX: How to replace content of a DIV with a link in same DIV ?

I have index.php like this: <script type="text/javascript" src="jquery-1.4.2.js"></script> <script type="text/javascript" src="ajax.js"></script> <a href='one.php' class='ajax'>One</a> <div id="workspace">workspace</div> one.php <?php $arr = array ( "workspace" => "<a href='two.php' class='ajax'>two</a>" ); echo json_encode($arr); ...

jquery click event is overridden when new object is created

I am writing an Ajax application which uses a callback function to add a card to a players hand. the object is created correctly and the menu for each object is also created correctly. when created the DOM object, in the callback function i use to add the object, i have some code like this: $("#card"+cardNum).live('click',function(){ ...

jQuery $.post request failing.

I'm sending a $.post request to php with jQuery. The jQuery code looks like this: $('form').submit(function() { username = $('input[name="username"]').val(); alert(username); $.post('/ajax/new_user.php', {username:username}, function(data) { alert(data); }); }); In PHP, I'm just trying to do this for now: <...

Two POSTs When Using jQuery

I am using the jQuery UI Tabs to display a number of forms (each tab can contain more than one form). When I switch between tabs, I am attempting to do POST of the tab's forms using AJAX calls. Here is the jQuery for what I am doing. select: function (event, ui) { var tab_index = $('#tabs').tabs('option', 'selected'); v...

how to redirect to custom Joomla error code page when error occurs in ajax?

Hi, This questions is bit specific to joomla. I have created the custom error page error.php in /template/MY_TEMPLATE/error.php. This file checks for the error codes and displays different message for each http code I set(I check with $this->error->code == '404'). Normally this works good. Now the question is, how should I handle same ...

Reading json data return to jQuery

I'm using the following code to get some json formatted data: $.ajax({ type: "GET", url: "MyService.svc/GetSomeData", dataType: "text", success: function (data, textStatus) { alert("Test: " + data.toString()); }, error: function (xhr, textStatus, er...

jQuery post from ASP.NET web page (WebMatrix)

Hi everyone! I'm trying to submit form data with jQuery. I'm using ASP.NET WebMatrix. In a .cshtml file I have @{ // other code if(IsPost) { var item = new Item(); item.Title = Request.Form["title"]; item.Description = Request.Form["description"]; // aditional code here } } <script type...

Ajax.Request apparently not evaluating JS code

Hi, I am creating a report, both the interface for the report parameters and the report itself is created by the exact same php file. This are the first lines of the part of the file called when the report is being created: <script type="text/javascript">alert("bla");</script> Whenever I use this code to pull the report new Ajax.Up...

jQuery ajax load html from another server

Hey all i am trying to find a way to call an external website and retreve its HTML so that i can check for something in it (wither the user entered a valid VIN # or not depending on what this website calls back) This is the code i have: $.ajaxSetup ({ cache: false }); $("#load_callback").click(function(){ $.ajax({ url: 'htt...

How to call AJAX request on dropdown change event ?

index.php <script type="text/javascript" src="jquery-1.4.2.js"></script> <script type="text/javascript" src="ajax.js"></script> <a href='one.php' class='ajax'>One</a> <a href='two.php' class='ajax'>Two</a> <div id="workspace">workspace</div> one.php $arr = array ( "workspace" => "One" ); echo json_encode( $arr ); two.php $arr = ...

how to make tree model?

how to make tree model? ...

JQuery $.post not working on some PCs

Hi guys, I have a very strange problem with JQuery $.post() I have implemented it in my new web application and get messed response from QA after testing, some say it is working perfectly and some say it is not working; It generate no error and no warning,,, but i am very upset i have almost compeleted the application and it is impossibl...

How to pass values of form input fields to a script using AJAX/jQuery ?

My current code is like this. index.php <script type="text/javascript" src="jquery-1.4.2.js"></script> <script type="text/javascript" src="ajax.js"></script> <select id="dropdown_id"> <option value="one.php">One</option> <option value="two.php">Two</option> </select> <div id="workspace">workspace</div> one.php $arr = array ( "wor...

jQuery/AJAX Formatting layout - My Tiny Todolist

Hi Guys, I'm trying to modify http://www.mytinytodo.net/ to integrate it into an app I'm developing. Unfortunately my jQuery/AJAX ability is rubbish at best. I want to do two things: 1) Tasks to be placed into a parent div depending on due date class. For example, tasks that have already gone past their duedate are placed inside 'e...

Accessing relative URL's via "ajax" from "file://" content

I'm putting together some demo pages, and one of the things I want to demonstrate involves fetching HTML fragments dynamically with subsequent processing. Thus I've got simple jQuery code like this: $('#target').load('./content_fragment.html', function() { $(this).doSomething(); }); I'm doing all this from file:// URLs because the w...

jQuery Ajax tooltip

I try to do Ajax tooltip via this jQuery plugin: http://jquery.bassistance.de/tooltip/demo/ I have some thing like this: <p id="foottip"> <span href="/last_votes/6">footnote</span>. </p> <script type="text/javascript"> $(function() { $("#foottip span").tooltip({ bodyHandler: function() { //dj ajax here and cache ...

Should ajax calls go through as few as possible entry points to an application or many specific methods

I'm building a web app with a lot of ajax calls to be made. Should I be trying to keep a small number of methods, and just pass in information about what type of request it is, and then switch based on that type inside the method or Many smaller methods, so don't have to pass in type, but more code to write setting up each method. Cu...

ASP.NET MVC forces an AJAX request be redirected to the login page when the FormsLogin session is no longer active

I have some AJAX calls that render PartialViewResults via the jQuery.AJAX method. This works great, I get my views rendered exactly the way I want. The problem arises when I leave the page up for a while and the Forms auth session expires. When I click an action that performs an AJAX request, it shows the login page in my div. I want ...