AJAX :: Perform A Php Function Rather Than Load A Page?

Feb 4, 2010

I have this code below:

Code:

$('#admintable').load("/includes/ajax.php?type=gallery&action=order&var=" + $.tableDnD.serialize());

The problem is that throughout my php project it calls different classes and definitions based on what modules are loaded.Is it possible to get it to load a function that is predefined rather than executing a page that will require me to once again declare all my variables and classes so I can perform just a simple db search.

View 4 Replies


ADVERTISEMENT

Ajax :: First Function Call On Page Load Always Skipped

Oct 9, 2010

Trying to call the same Ajax function twice on initial load of the page, but only the second one executed. I try to load mainpage, and inside mainpage I try to use ajax to load content1.asp to div1 and content2.asp to div2.

Test scenario (based on the Situation below):
- Page loaded, 1st ajax function skipped, 2nd ajax function loaded
- Remarked 1st ajax function, then 2nd ajax function loaded
- Remarked 2nd ajax function, then 1st ajax function loaded
- Moved the 2nd ajax function to above 1st ajax function, the 2nd ajax function is skipped.

Conclusion:
- the 1st ajax function always skipped. But Why? How to ensure both ajax is called upon loading of the page?

Situation:
mainpage.asp
<div id="div1"></div>
<div id="div2"></div>
<script language="JavaScript1.2">
ajax('div1', 'GET', 'page1.asp');
ajax('div2', 'GET', 'page2.asp');
</script>

ajax.js -
function ajax(strDivID, strMethod, strURL){
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}xmlhttp.onreadystatechange=function(){
if (xmlhttp.readyState==4 && xmlhttp.status==200){
document.getElementById(strDivID).innerHTML=xmlhttp.responseText;
}}
xmlhttp.open(strMethod,strURL,true);
if (strMethod="POST"){
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
}xmlhttp.send();
}

View 1 Replies View Related

JQuery :: Load Pages Into A Div Using The Load Function With AJAX

Feb 15, 2011

I have the following code to load some pages into a div using the load function. When I click one of the links though, nothing happens. I have read a couple of books on JQuery and looking at the examples they give, this looks correct so I am at a loss.

[Code]...

View 4 Replies View Related

Jquery :: Perform On Ajax Loaded Content?

Jul 10, 2009

I'm loading some content on a page with ajax. After it's loaded I can't seem to perform any more jquery on it. How do you get around this?

View 3 Replies View Related

Perform A Find In Page Search That Looks At A Specific Link, Opens The Page In A New Window?

Mar 29, 2011

It is possible to perform a find in page search that looks at a specific link, opens the page in a new window and finds the text within that document?? Basically I regularly use an html page in work that has a list of people and their telephone numbers. I want to be able to type in a searchbox on my main page and it open the target page and find the name I am looking for? Is this possible or can you only Find In Page on the same page or another frame?

View 1 Replies View Related

Ajax :: Perform A Request As Someone Is Typing Into A Text Field?

Nov 30, 2009

I need to perform an Ajax request as someone is typing into a text field. But I don't want to trigger a request on every key press. What I need is to perform the request if a key has not be pressed for x number of milliseconds.I seen an answer here - Time Restraint - but I'm having difficulty applying it to my situation.I'm using jquery and this is a trimmed down version of my current code:

javascript Code:
Original
- javascript Code

I don't know how to change this function to use setTimeout in a way that lets me execute a trigger function on a control relative to the current field. Ideally I need to pass $(this) as a parameter for the function setTimeout calls, but I don't know how to do that when the function call is passed as a string.

View 1 Replies View Related

Function Doesn't Perform 2nd Time Around

Jul 10, 2011

Code:

function randOrd(){ return (Math.round(Math.random())-0.5); }
var cardArray = [
[1, "hundo", "dog"], [2, "kato", "cat"],

[code]...

How come the random function has no effect on the second array it was given to randomize?

View 4 Replies View Related

JQuery :: Perform A Function On All Elements Within A Class?

Jun 18, 2011

I'm sure this is much simpler than I have been making it seem in my head so I'm giving up and asking Basically I have a html document being dynamically created by php. In the markup I create some divs (the number of which changes between pages) all of which belong to the same class (class="div") and have id's of the same format (id="div_90001" or "div_88926773"). What I want to do is perform a function on eachelementin the class and extract the number in the id and then perform a function with the number (AJAX) and then return the results to the div (probably some extra markup)

I can handle all the AJAX parts, the extracting of the id number etc... I just can't make a function that will work on all elements in a class. I fear I am not making much sense, I'll try again cos I don't think I'd understand what's above. I have some divs that belong to a class, I want to perform the same function on each of the elements in the class. How is this done?

View 1 Replies View Related

JQuery :: Automatically Perform A Function As Soon As The New Class Appears?

May 31, 2011

I'm using jquery file upload - when each file has uploaded, the name of the file appears, and I've added a check button:

<td colspan="2"><span class="ui-icon ui-icon-check"></span></td>

What I'd like to do is make jplayer fire off a "ding" sound as soon as each file is up.

For example (just to test)

$('.ui-icon-check').live('click', function() {
$(this).css("background-color","yellow");
});

needs an action, like a click or a mouseover or something. For each file that arrives, and therefore adds another instance of ui-icon-check, I'd like to fire an event. A weekend of googling has really only turned up Live Query from 2007, which works perfectly with

$('.ui-icon-check').livequery(function(){
$(this).css("background-color","yellow");
});

[Code]....

So am I totally mis-understanding the point of live, or just mis-using it?

I'm doing it this way rather than mess with the uploader code as he's updating the code all the time, and the more I can stay away from code code the better I think.

View 4 Replies View Related

Element.focus() Function Takes Ages To Perform?

Sep 28, 2010

My problem is that it takes ages to perform the element.focus() function. This is not a function I have written myself but is part of the Javascript language itself. There are probably a lot of reasons why this might be slow but I cannot find the right one. Let me describe my problem. We have a product which was created around 2004 and has been developed on since. The HTML and Javascript used for the product was based on a prototype which we then converted into a server based solution (we use Servlets/JSP).

Due to the nature of the prototype (and also the graphical layout) the major page consists of one huge HTML page which a lot of hidden DIV tags. These DIV tags are then toggled visible/invisible to make it look like we have a kind of tab functionality. We also do not load all tabs when we load the mail page, instead each tab is loaded into a hidden iframe and then with Javascript we grab the resulting HTML content and paste it into the main page, making that one tab visible while hiding all other tabs.

In one of these tabs we also do some more magic. The layout is as follows; we have sets of three columns each and then a lot of rows. Each set of three columns contains one text field per column. The last text field contains a percentage value and when edited, we check if the value is lower then before the edit and if it is, then we split the column, creating another set of three columns.

When we load the page the first time, there exists only one set of columns with the last column having the value 100. There can however easily be 100 rows as well. For the larger pages we can have (at load time) three columns which makes it 900 text fields. I do not know if this is much or not.So, with the above info, to my problem. First off, when I try to move the marker and click on a given field (so that the marker starts blinking on the selected field) it takes maybe 2-3 second (although not always, seems to be more the first time). If I then tab to the next field it goes very fast (like one would expect).When I try to edit a value (by simply adding or removing values) it again takes a very long time (the first time).

When I then try to tab, it takes ages (this happens always, not only the first time).My Javascript then. I have two events, onchange and onkeydown. onkeydown checks if a variable is set to true or not. If it is set to true, the method does nothing. If set to false it does a bunch of tests and sets the variable to true. onkeydown is what I think causes my first lag but the code is not really that advanced (no loops or anything). onchange does the same checks plus all the magic (with the split etc). One of the last things it does is try to set focus on the next text field and this goes extremely slow all the time.

We use IE8. We (sadly) have a lot of IE specific stuff so the site doesn't even work in Firefox. I have used IE8 Developer Tools and used the Profiler which basically gives a list of Javascript calls and their execution times. My own functions take basically zero time, but there are A LOT of calls to functions that are not named, or anonymous, according to the Profiler.

How do I find what the anonymous function calls are?Why is it the focus() function that takes time, can it (or is it) still some of our own Javascript that makes that function go slow, even though it is part of the Javascript language?Can it be the amount of elements on the page (900 text fields)? Is that much?Can it be IE8? Are there known issues with this?

View 1 Replies View Related

What Script Is Being Used To Perform The Sliding Drop Down Panel For Logins At The Top Of The Page?

Sep 25, 2009

What script is being used to perform the sliding drop down panel for logins at the top of this page: http:[url]....

View 6 Replies View Related

JQuery :: Calling Function Defined In Ajax Load?

Jul 5, 2010

if i am using jquery's $.ajax to load content and the content in the url ('test.php')

is <script type="text/javascript">function test() {alert('test called');
}
</script>

how do i get the function test() to execute?as if i call it (from the parent page in the success function)i get told it is undefined

View 5 Replies View Related

AJAX :: Cannot Get JS Content From Page To Load

Dec 9, 2009

I have been searching online for hours, but it is possible I'm just not thinking of the correct keywords. I have included a basic illustration of the current setup (which does not work). The issue lies with the page that is the desired output. I have a far deeper issue which I have narrowed down to javascript on the final .asp page not loading at all.

On default.asp, I am calling a function contained in 'ajax_call-contentselection.js'

Code:

<a onclick="func_displaycontents('restaurants'); return false">displayajaxcontent</a>

Honestly, I don't believe the following piece of code (ajax_call-contentselection.js) is relevant, as it is standard ajax code, but just in case:

Code:

function func_displaycontents(var_type){
var xmlHttp = GetXmlHttpObject();
var url = "../_include/ajax_display-contentselection.asp";

[code]...

The other contents of "ajax_display-contentselection.asp" are displayed properly in "div_ajaxfillattractions" of "default.asp", but no javascript code on that page loads. If I use "ajax_display-contentselection.asp" as an include file on "default.asp", I get the javascript alert of 'Success', but when I initiate the AJAX it does not work, so I know there isn't a problem with the javascript.

View 6 Replies View Related

JQuery :: Ajax .load() Function Appends A 0 To Returned Values?

Jun 26, 2009

My code looks like this:

$('#edit' .postcontent').load('admin-ajax.php', {'action':'qe-
getpost'});

Everything works great - the returned value is loaded into .postcontent perfectly. However, a 0 is appended to the end. Every time. Even if I return nothing, a lonely 0 shows up inside .postcontent.

View 1 Replies View Related

JQuery :: Ajax Load Function - Show / Hide Report DIV

Jul 28, 2009

I have a function that uses the ajax load function to post off some parameters and fill a div with the returned content after a db query has been run to create it. This all works fine, however I would like to be able to replace the div with a loading graphic whilst the content
is generated. I assumed this was done by placing the graphic at the start of the function, then using a callback function to remove it and display the actual data once it has been fully generated...

However when I trey to implement this I am getting a strange result in that the callback fires before the content is generated. So my loading graphic disappears and then the content appears sometimes 10 seconds later. How can I ensure the call back only executes once the new content is
ready to be displayed ??

Here's my code ...
function get_report(){
// Hide #report_here div and show loading graphic here ...
$("#report_here").load("/admin/reports/statistics_report/", {
// Parameters sent go here
}, finished()
);
function finished() {
// Hide loading graphic and show #report_here div here ...
}

View 1 Replies View Related

Ajax :: Script To Load Dynamic Content OnClick Function

Sep 16, 2010

I'd like to place an AJAX call to load another SELECT menu in my form, and I'm having trouble finding a tutorial. For your Copying/Pasting pleasure :rolleyes:, here's an example button for which I'd include the onclick():
<button type="button" >Add</button>

And here's an example SELECT menu:
<select id="idNumber" name="weekday_1['workPeriod_new'][] >
<option value="1" >one</option>
<option value="2" >2</option>
</select>

View 10 Replies View Related

JQuery :: Load An Entire Page With Ajax?

Mar 16, 2011

i want to load my entire front page with jquery, after a button is hit. Something like redirect to front-page.

I've already got the handler on the button, that executes document.location.href = '/index.php' Its working, but i'd like to make its behave like(pseudocode): $.ajax('/index.php') or: $.load('/index.php')

Is that possible, and if it is, how can i do that?

View 2 Replies View Related

JQuery :: Ajax Firing At Page Load?

Jun 17, 2009

This script (below) is firing at page load. how not to get it to fire until and event happens.

$(document).ready(function () {
if($('#DrainStackDiameter').val() != null){
$('#PowerPipeConfigurations').change(function(){ getResults
(); }).change();

[Code].....

View 1 Replies View Related

JQuery :: Scroll To Top Of Page After AJAX Load?

Aug 23, 2009

Using AJAX to load content within a div. Need to find a way to scroll to the top of the page after loading content inside div on same page. After clicking on my bottom links, loading the html inside the div, I want the the parent window to scroll up to the top. scrollTo did not work.

View 1 Replies View Related

JQuery :: Using Ajax, If Load An Entire Page Into A Div

Oct 21, 2011

If i have two web pages, say A and B. If I use ajax to load A into a div located within B what would this do considering that both pages have doctype, html, head, etc.? Would this cause a problem or would I be better off parsing out the section of A that I want to include in B?

View 3 Replies View Related

JQuery :: Click Function Not Working After Document-load Ajax Call?

Oct 15, 2011

big fan -- first time poster. I've been learning javascript and jquery on the fly so bear with me if I seem to lack understanding of what may be semantic basics.

Anyway, I'm building a mobile app using phonegap. One page grabs data for a table from ajax, and each table element has a delete button in one of the cells. In short: the clicks aren't working. I put the alert in to test, and no dice. I'm not asking for help on the internals, I'm just stumped on why the function isn't being activated,

[Code]...

View 6 Replies View Related

JQuery :: Load Function And Ajax - Include All In The External Html Content?

Jan 31, 2010

I created a page (index.html, including the embedded javascript) with a div loaded by an external html content. But in this new content the click function I defined in the index.html page does not work in the new content. Then my question is: do i need to include all javascript in the external html content?

View 1 Replies View Related

Ajax :: Modification - Function To Load Text File Information From The Server

Sep 24, 2011

I have been successfully using the following "myAjax" function to load text file information from the server.

ajax.js:

After I load the text file, I store the text "records" into an array by doing something like this:

Where the '}' character is my record delimiter. It could just as easily be ' ' or ' ' or the like.

Again, I am not having any problems doing it this way as it suits my current needs.

Now the question(s)

1. Does the call to read the text data from the external file always read in the entire contents or can I read one line or delimited record at a time and store it to the array directly without the text storage?

2. If the text is always read completely (my suspicion), can I safely delete the "TextInformation" after I convert to the array format? Is there any memory penalty for doing it this way as the text information can be somewhat lengthly and I don't like the idea of having doubled memory usage when I only need the information in array format anyway?

This is the idea I am considering, but I don't know if there are drawback to this method of if there is a better way to accomplish the task.

ajax.js:

View 18 Replies View Related

JQuery :: Ajax Load A Page With Google Map Inside?

Mar 6, 2010

I tried to do a loading bar during the computation of the data of my google map, unfortunately without success for the moment. I use the load function serveral times but never with a google map / javascript, that's probably the problem linked to it. Here is my 2 html pages : 1- dynamicmap.html 2-googlemap.html.

For information, I worked with Django, the googlemap.html works very well when I used this "outside" the dynamicmap.html ... I tried to add the function "initialize()" as argument to load function. I am very lost about how to do. Any remarks is welcom i am still new in webdevelopment, but experimentend in classic programation.

[Code]...

View 1 Replies View Related

JQuery :: Execute .hide() After Ajax Page Load

Mar 1, 2011

I have a problem hiding elements after ajax respons.

I have a JQuery script:

$(function() {
$(".tab_content").hide();
$("ul.tabs li:first").addClass("active").show();
$(".tab_content:first").show();

[Code]....

onClick event binded on <li> tag with live() works fine. But I need to hide some tags immediately after ajax call. The jquery script is included together with some HTML code in returned HTTPrespons content data. Is it possible to do this without setting css display:none property?

View 2 Replies View Related

JQuery :: Use Ajax To Load A Html Page And Get The Content Of A Specific Div?

Mar 20, 2011

I would like to use ajax to load a html page and get the content of a specific div. Is it possible to do this?

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved