Menu icon Foundation
How to load content via ajax into modal

How do I bring up user info based on a customer_id into a foundation modal? Having some difficulty. Any help would be appreciated!

 

<a href="#" data-reveal-id="modal_inquiry_editUser" data-reveal-ajax="true" class="inquiries_editUser" id="<?php echo $row['customer_id'];?>"> <i class="fi-page-edit large"></i> </a>

 

$('.inquiries_editUser').click(function(event) {
var customer_id = this.id;

//$('#modal_inquiry_editUser').foundation('reveal','open');

//put customer id into input value in the modal 
//$("#modal_inquiry_editUser #customer_id").val(customer_id);

// url with extra parameters
$('#modal_inquiry_editUser').foundation('reveal', 'open', {
url: 'inc/editInquiry.inc.php',
data: {id: customer_id}
});
});

modaljqueryAJAX

How do I bring up user info based on a customer_id into a foundation modal? Having some difficulty. Any help would be appreciated!

 

<a href="#" data-reveal-id="modal_inquiry_editUser" data-reveal-ajax="true" class="inquiries_editUser" id="<?php echo $row['customer_id'];?>"> <i class="fi-page-edit large"></i> </a>

 

$('.inquiries_editUser').click(function(event) {
var customer_id = this.id;

//$('#modal_inquiry_editUser').foundation('reveal','open');

//put customer id into input value in the modal 
//$("#modal_inquiry_editUser #customer_id").val(customer_id);

// url with extra parameters
$('#modal_inquiry_editUser').foundation('reveal', 'open', {
url: 'inc/editInquiry.inc.php',
data: {id: customer_id}
});
});
Rafi Benkual over 3 years ago

This looks like a Foundation 5 example. Are you building on Foundation 5? 

Rafi Benkual over 3 years ago

If it's Foundation 6, we actually just published a lesson on doing this today: http://zurb.com/university/lessons/ajaxing-dynamic-content-with-foundation

Mike Cerveni over 3 years ago

It's foundation 5. I actually figured it out myself. I didn't have to use ajax for it either! Just put the href link inside the button that opens the modal, in the link i put the id variable in there and it opened the proper info. 

Mike Cerveni over 3 years ago

I'll take a look at the link you provided though as well. Thank you!

Mike Cerveni over 3 years ago

looking at your lesson, would i just add a variable through ajax like normal? let's say i want to pass an ID into the link. 

Mike Cerveni over 3 years ago

Would it be possible using this technique in foundation 5?