473,796 Members | 2,676 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Jquery binding ajax functions

2 New Member
Hi everyone.
I am having an issue with jquery.

I have a drag and drop jquery plugin. It works fine when run standalone. but when this drag and drop is called via ajax and being loaded on to the main page it does not work. what could be the reason?

I am loading this drag and drop html from jquery function which is given below.

Expand|Select|Wrap|Line Numbers
  1. function showDD()
  2. {
  3.     $.ajax({
  4.     type: "POST",
  5.     url: 'dragndrop.php',
  6.     success: function(msg){
  7.         $('#dd_div').html(msg);
  8.     },
  9.     error: function(){ 
  10.         alert('Error');
  11.     }
  12.     });
  13. }
  14.  
drag and drop html is loaded in <div id="dd_div"></div>.
but it does not work.
I have included all the required files for drag and drop plugin on the main page (same page on which the above function is written.)

files required for plugin are also included on top(jquery.js and drag and drop ui.js) along with the following code which is required for the drag and drop plugin.

Expand|Select|Wrap|Line Numbers
  1. $(document).ready(function(){ 
  2.  
  3.     $(function() {
  4.         $("#contentLeft ul").sortable({ opacity: 0.6, cursor: 'move', update: function() {
  5.             var order = $(this).sortable("serialize") + '&action=updateRecordsListings'; 
  6.             $.post("saveLiPostions.php", order, function(theResponse){
  7.                 //do some stuff here
  8.             });                                                              
  9.         }                                  
  10.         });
  11.     });
  12.  
  13. });    
  14.  
  15.  
Is this because of the document.ready ???
what could be the solution.

Any help would be appreciated.

Kind Regards
Sep 24 '10 #1
2 1594
HassanKazmi
2 New Member
can anyone help me with this???
Sep 26 '10 #2
gits
5,390 Recognized Expert Moderator Expert
if you load a html-page with an XMLHttpRequest and that page does use javascript then you would need to call any initializing methods again ... the nodes are added after the previous code was already executed so any behaviour that was applied to the documents's nodes in an onload or whatever before is not applied to the nodes that are added later on ...
Sep 26 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
1752
by: Jens Thiele | last post by:
i want to bind a member function i hope this example will explain what i want to do (it seems my solution works - but is there a better way?) // first a simple function variable example function foo(){ print("foo"); } // prints foo and foo function simpleTest(){
4
3114
by: Gale | last post by:
What is the best AJAX function and where can I download it? Thank you!
1
1862
by: c19h28o2 | last post by:
Hi, I'm a little stuck with Ajax (really am not getting it at the moment!) I'm trying to write into a div when something is typed into a box... <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head>
1
1150
by: devi16 | last post by:
i want to know is there any javascript functions which dynamically switch to the other tabs without reloading the page. Now i have tabs such that if i click on it the page reloads and shows that page. How can i do it dynamically without loading.. Will ajax help it out.
3
1604
by: cbellew | last post by:
Hi guys, Let me just introduce my problem - i hope someone will be able to help! I have an index page for my site where i want the user to have the choice to view a login form or registration form. I have index.php with two links ("Click to login", "Click to Register"). I want to use ajax so that the user can switch between the forms without having to load the page. At the moment i have the forms stored in seperate html pages and i want...
5
2117
by: phpachu | last post by:
Hi, I hav a problem with Ajax and PHP. I had populate a dropdown w.r.t to another dropdown using ajax. But the problem is I hav to list some data on the selected index change that newly created ajax dropdown using AJAX with reloading the page. Where i hav to call the ajax function to list the data?Because That dropdown is created using ajax on another page ..What can I do? Can any one plz help me....Im struggling with that for last...
3
3720
by: Don Quijote de Nicaragua | last post by:
Hi, is there any way to insert a registration in SQL Server using Jquery en ASP.NET.
3
17697
by: George | last post by:
I am doing an AJAX call using JQuery on my page to which returns JSON objects and everything works fine. Now I decided to use ashx handler instead of and simply write JSON out. Then my problems begun. So here is JQuery call $.ajax({ type: 'POST', url: url,
3
1827
pradeepjain
by: pradeepjain | last post by:
hii guys, I am newbie to jquery and ajax . I am stuck to know when to use jquery and ajax . which is better to use and fast . can anyone plz explain .
1
1167
by: jowkar | last post by:
basically im trying to combine jquery with ajax dynamic content and this is what happens i have a page with a div with content that changes content thanks to ajax. one of those content pages is a form im trying to validate with jquery, however, it appears when i go fill out the form, as if jquery wasnt loaded, when its loaded in the head of the main page which contains the div. any ideas?
0
10452
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10221
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9050
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7546
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4115
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.