October 3, 2019
Focaccia Is a Mood
Article-Homemade-Focaccia-Bread-Recipe

Pile it high with crispy mushrooms, briny anchovies, and creamy, salty cheeses.

For centuries, focaccia has had a quiet, rustic appeal, always outshined by its trendy, cosmopolitan cousin: pizza. But what it lacks in flair, it more than makes up for with its airy, perfumed interior and golden, oil-crisped crust. A fresh focaccia might be understated, but it’s extremely satisfying, both to eat and to make. The highly active yeast culture and a healthy glug of olive oil make for a vivacious, bubbly dough that feels like silk beneath your fingers, and it bakes into an impressively leavened bread with an admirable ratio of crumb to crust.

Perhaps that’s why so many chefs and home cooks have answered the focaccia call in recent years. In 2017, when Felix Trattoria opened in Los Angeles, chef Evan Funke started serving a rosemary-topped focaccia that developed a cult following of its own, even if they technically refer to it as sfincione (a focaccia-adjacent bread from Sicily). In New York, Il Buco Alimentari & Vineria took a new approach with its focaccia, piling its high after it’s been baked with ingredients like roasted squash, sautéed greens, cured anchovies, and sliced mortadella. Brooks Headley, of New York restaurant Superiority Burger, recently made perfecting Roman-style focaccia his newest passion project.

Focaccia may have reached its cultural peak, though, in October 2018, when Samin Nosrat’s four-part series Salt, Fat, Acid, Heat debuted on Netflix. Viewers went nuts for the focaccia she learned to make in the first episode—a refined Ligurian-style loaf with no toppings but for a sheen of salamoia, the blend of oil, salt, and water that evaporates as the bread bakes, leaving a crisp layer of salt behind on the surface. The baker in the episode presses his fingers into the dough, creating dimples for the salamoia to collect in, and little buried bubbles spring to the surface. It’s mesmerizing.

The two-stage approach opens up a diverse world of topping possibilities.

This straightforward approach results in a subtle and lightly seasoned flatbread that you could happily eat on its own. But for me, even a dependably great base focaccia recipe (like the one below) is an airy, neutral vehicle for toppings—an opportunity for savory, spicy, salty, and aromatic elements to playfully collide in your mouth.

In Italy, focaccia takes many different shapes in different regions. It can be smeared with tomato sauce, or studded with olives, or peppered with rosemary, or entirely eclipsed by a layer of cheese and charcuterie. It can be circular or square, and it can be made with butter or olive oil or lard. Its airy interior and topping-to-crust ratio usually distinguish focaccia from pizza, that other world-dominating Italian flatbread, but in some places, the fine line between the two becomes nearly invisible.

burrata anchovy focaccia bread recipe

At Pizzarium Bonci, one of my favorite pizza destinations in Rome, dozens of bubbly, rectangular pizzas line the counter, all piled high with toppings like roasted summer squash, fresh ricotta, and thinly sliced house-made porchetta. The dough is distinctly pizza dough—chewy and with large, sparse air bubbles, as opposed to the very bubbly, more evenly-crumbed focaccia—but the topping philosophy is perfectly adaptable for focaccia. Some ingredients are baked directly onto the crust and others are added after the fact, once the pizza has cooled.

The two-stage approach opens up a diverse world of topping possibilities when you don’t have to be concerned about an ingredient having the life scorched out of it in a 450-degree oven. Since focaccia is most commonly served at room temperature, ingredients like ricotta or stracciatella (the gooey, creamy cheese on the inside of burrata), fresh basil and oregano, and marbled, fennel-flecked finocchiona aren’t in danger of dehydrating, wilting, or sweating.

The best focaccias I’ve made tend to center around this two-step topping idea. Anything that might benefit from the heat of the oven goes on top of the focaccia dough after it’s dimpled, and the remainder of the toppings come along once it’s cooled a bit. The result is not just a contrast of flavors, but of textures and temperatures. It allows for umami-packed anchovies and cooked tomatoes to mingle with cool, creamy burrata. Roasted mushrooms and caramelized shallots can meet fresh, green herbs and a dollop of ricotta. A field of melted provolone cheese sits under ribbons of shaved mortadella, which becomes shimmery with fat as it melts atop the hot crust and collides with a spicy, vinegary mix of minced chiles, artichokes, olives, and garlic.

The base for all of these recipes is a multipurpose, no-knead focaccia dough that even the most timid home bakers can get behind. The base dough makes a great toppingless focaccia, too (just brush with olive oil and sprinkle with flaky sea salt before baking and call it a day), but I encourage you to follow the more-is-more layering philosophy. The higher you can pile them, the better.

 

Basic Focaccia

1 13x18 inch loaf

Ingredients

  • 800 grams all-purpose flour
  • 640 grams water
  • 60 grams extra-virgin olive oil
  • 17 grams kosher salt
  • 7 grams active-dry yeast (one packet)

This recipe uses specific weight measurements in grams to ensure an even proportion of the ingredients. If you don’t have a dry scale, I highly recommend purchasing even a cheap one, but you can also look up the approximate volume equivalents online. Just remember, there’s a lot of variability in mass between even one cup of all-purpose flour and one cup of bread flour.

This recipe also includes a bulk fermentation, which helps kickstart aeration, which can last between one and two hours, before it goes into the fridge for at least 8 hours, which slows down the fermentation and allows more flavor to develop. You can leave the dough in the fridge, covered loosely in plastic, for up to 24 hours, so consider what time you’d like to bake it, and plan accordingly. Since half of the toppings are added once the focaccia is relatively cool, you can bake a loaf a few hours or a day in advance, wrap it tightly in plastic and store it in the fridge.

To serve, warm gently in a low oven to take the chill off before adding the final toppings.

  1. In a small bowl, combine 100 grams of the water with the yeast. Stir to dissolve and let sit until foamy, about 5 minutes.
  2. In a large bowl, combine the flour, remaining water, and 30 grams of olive oil. Add the yeast mixture, and mix thoroughly with your hands until all the visible flour is incorporated and a shaggy dough forms, about 3 minutes.
  3. Cover the dough loosely in plastic wrap and set aside to autolyse for 30 minutes. This will help the flour to become fully hydrated, activating enzymes that will help the yeast to access its nutrients.
  4. Sprinkle the salt over the dough and mix with your hands until fully incorporated. The dough should feel smooth and supple and a little taught.
  5. Cover with plastic wrap and allow the dough to sit at room temperature for about 1-2 hours to ferment. It should appear bubbly and nearly doubled in size. It's okay if it hasn't fully doubled by this point; it will continue to ferment in the fridge.
  6. Chill the covered dough for at least 8 hours, and up to 24. This lengthy fermentation will develop flavor and structure.
  7. Remove the dough from the fridge and allow the dough to warm slightly at room temperature, about 30 minutes.
  8. Apply 15g of olive oil to a 13x18" rimmed baking sheet and use a spatula to scrape the dough from the bowl onto the oiled sheet. Using oiled hands, gently stretch dough, pushing it into the corners of the pan. If it tenses up, let it rest for 5-10 minutes. This will allow the gluten to relax, making it easier to stretch.
  9. Using hands or a pastry brush, gently rub 15g of olive oil over the top of the dough. Cover gently in plastic wrap and allow to proof in a warm place for 1-2 hours, or until it's puffy and bubbly, and has grown to fill the tray. 30 minutes before baking, preheat the oven to 450°F.
  10. When the oven is preheated and the dough is puffy, use your fingers to press deep dimples across the entirety of the dough. Bubbles should rise to the surface, and the dough should spring back only slightly, leaving the dimples intact.
  11. Apply any toppings and bake until the focaccia is crisp and golden brown, about 20-25 minutes. If not using additional toppings, drizzle generously with olive oil and sprinkle with flaky sea salt.
  12. Remove from oven, allow to cool slightly, and, if serving immediately, apply any remaining toppings. Alternatively, wrap the cooled focaccia in plastic and refrigerate up to 24 hours before serving. To serve, warm gently in a low oven, and apply any remaining toppings immediately before serving.

Ingredients

  • Basic Focaccia Dough
  • 800 grams all-purpose flour
  • 640 grams water
  • 60 grams extra-virgin olive oil
  • 17 grams kosher salt
  • 7 grams active-dry yeast (one packet)
  • Toppings
  • ½ teaspoon kosher salt
  • 2 cloves garlic
  • 20 oil-packed anchovy fillets
  • 1 teaspoon extra-virgin olive oil
  • ¾ cups pure tomato sauce or canned crushed tomatoes
  • 8 ounces burrata
  • Freshly ground black pepper

Tomato sauce can burn easily in a hot oven, so if the focaccia starts to darken too soon before it’s done, tent loosely with aluminum foil for the remainder of the bake. You can adjust the number of anchovies on top to your own preference.

    Basic Focaccia Dough

  1. In a small bowl, combine 100 grams of the water with the yeast. Stir to dissolve and let sit until foamy, about 5 minutes.
  2. In a large bowl, combine the flour, remaining water, and 30 grams of olive oil. Add the yeast mixture, and mix thoroughly with your hands until all the visible flour is incorporated and a shaggy dough forms, about 3 minutes.
  3. Cover the dough loosely in plastic wrap and set aside to autolyse for 30 minutes. This will help the flour to become fully hydrated, activating enzymes that will help the yeast to access its nutrients.
  4. Sprinkle the salt over the dough and mix with your hands until fully incorporated. The dough should feel smooth and supple and a little taught.
  5. Cover with plastic wrap and allow the dough to sit at room temperature for about 1-2 hours to ferment. It should appear bubbly and nearly doubled in size. It's okay if it hasn't fully doubled by this point; it will continue to ferment in the fridge.
  6. Chill the covered dough for at least 8 hours, and up to 24. This lengthy fermentation will develop flavor and structure.
  7. Remove the dough from the fridge and allow the dough to warm slightly at room temperature, about 30 minutes.
  8. Apply 15g of olive oil to a 13x18" rimmed baking sheet and use a spatula to scrape the dough from the bowl onto the oiled sheet. Using oiled hands, gently stretch dough, pushing it into the corners of the pan. If it tenses up, let it rest for 5-10 minutes. This will allow the gluten to relax, making it easier to stretch.
  9. Using hands or a pastry brush, gently rub 15g of olive oil over the top of the dough. Cover gently in plastic wrap and allow to proof in a warm place for 1-2 hours, or until it's puffy and bubbly, and has grown to fill the tray. 30 minutes before baking, preheat the oven to 450°F.
  10. While the dough rises and the oven preheats, combine the salt, garlic cloves, and 4 of the anchovies on a cutting board. Roughly chop, and then run the edge of your knife across the mixture multiple times to create a coarse paste.
  11. In a small skillet or saucepan over medium, add the olive oil and heat until shimmery. Add the anchovy and garlic paste and cook, stirring frequently, until fragrant, 1-2 minutes. Be careful not to brown the garlic.
  12. Add the tomato sauce or crushed tomatoes and cook until the flavors have melded and the mixture has reduced only slightly, about 5 minutes. Set aside.
  13. When the oven is preheated and the dough is puffy, use your fingers to press deep dimples across the entirety of the dough. Bubbles should rise to the surface, and the dough should spring back only slightly, leaving the dimples intact.
  14. Using the back of a spoon or a pastry brush, spread the tomato mixture across the top of the dough, sparsely covering it all the way to the edges of the pan. Cover the dough with the 16 remaining anchovies, arranging them in a diagonal pattern.
  15. Bake until the focaccia is crisp and golden brown, about 20-25 minutes. If the tomato mixture is coloring too quickly, cover the focaccia in a sheet of aluminum foil for the remainder of the bake.
  16. Remove from oven, allow to cool slightly, and shred pieces of the burrata on top. Use the back of a spoon to spread the creamy filling across the surface. Season with freshly ground black pepper. Serve immediately.
Mushroom and Herb Focaccia

Mushroom and Herb Focaccia

1 13x18 inch loaf

Ingredients

  • Basic Focaccia Dough
  • 800 grams all-purpose flour
  • 640 grams water
  • 60 grams extra-virgin olive oil
  • 17 grams kosher salt
  • 7 grams active-dry yeast (one packet)
  • Toppings
  • 1 medium shallot, sliced
  • 8 ounces fresh mushrooms, like cremini, oyster, shiitake, or a mix
  • 3 tablespoons extra virgin olive oil, plus more for drizzling
  • ½ teaspoon extra virgin olive oil, plus more for drizzling
  • Flaky sea salt
  • 2 tablespoons fresh oregano, chopped
  • 2 tablespoons fresh thyme
  • 2 tablespoons fresh chives, chopped
  • 1 cup fresh ricotta
  • Freshly ground black pepper

Use any sort of hearty mushrooms you like in this recipe. Creminis are easy to find, but oyster mushrooms, porcinis, or shiitakes—or a mix—all work great. The herbs are also easily adapted to your taste: Chopped rosemary or torn basil leaves would make an excellent addition.

  1. In a small bowl, combine 100 grams of the water with the yeast. Stir to dissolve and let sit until foamy, about 5 minutes.
  2. In a large bowl, combine the flour, remaining water, and 30 grams of olive oil. Add the yeast mixture, and mix thoroughly with your hands until all the visible flour is incorporated and a shaggy dough forms, about 3 minutes.
  3. Cover the dough loosely in plastic wrap and set aside to autolyse for 30 minutes. This will help the flour to become fully hydrated, activating enzymes that will help the yeast to access its nutrients.
  4. Sprinkle the salt over the dough and mix with your hands until fully incorporated. The dough should feel smooth and supple and a little taught.
  5. Cover with plastic wrap and allow the dough to sit at room temperature for about 1-2 hours to ferment. It should appear bubbly and nearly doubled in size. It's okay if it hasn't fully doubled by this point; it will continue to ferment in the fridge.
  6. Chill the covered dough for at least 8 hours, and up to 24. This lengthy fermentation will develop flavor and structure.
  7. Remove the dough from the fridge and allow the dough to warm slightly at room temperature, about 30 minutes.
  8. Apply 15g of olive oil to a 13x18" rimmed baking sheet and use a spatula to scrape the dough from the bowl onto the oiled sheet. Using oiled hands, gently stretch dough, pushing it into the corners of the pan. If it tenses up, let it rest for 5-10 minutes. This will allow the gluten to relax, making it easier to stretch.
  9. Using hands or a pastry brush, gently rub 15g of olive oil over the top of the dough. Cover gently in plastic wrap and allow to proof in a warm place for 1-2 hours, or until it's puffy and bubbly, and has grown to fill the tray. 30 minutes before baking, preheat the oven to 450°F.
  10. In a medium bowl, toss the shallot and mushrooms with the olive oil. Add the kosher salt and toss to combine.
  11. When the oven is preheated and the dough is puffy, use your fingers to press deep dimples across the entirety of the dough. Bubbles should rise to the surface, and the dough should spring back only slightly, leaving the dimples intact.
  12. Drizzle some more olive oil over the surface of the dough, and then distribute the mushrooms evenly over the surface. Sprinkle generously with flaky sea salt.
  13. Bake until the focaccia is crisp and golden brown, about 20-25 minutes.
  14. Remove from oven, allow to cool slightly, and spoon the ricotta in dollops across the surface. Scatter the fresh herbs on top and season to taste with black pepper. Serve immediately.

Ingredients

  • Basic Focaccia Loaf
  • 800 grams all-purpose flour
  • 640 grams water
  • 60 grams extra-virgin olive oil
  • 17 grams kosher salt
  • 7 grams active-dry yeast (one packet)
  • Toppings
  • Extra virgin olive oil, for drizzling
  • 12 slices deli-style provolone cheese (6 oz)
  • ½ cup Calabrian hot spread sauce
  • 10-12 extra-thin slices mortadella (8 oz)

“Hot spread sauce” is a popular condiment in Calabria, the southernmost tip of Italy. It is a spicy, vinegary, multipurpose spread made from Calabrian chiles and chopped mixed vegetables that makes a great addition to sandwiches, eggs, and other dishes in need of a little kick. Ask your deli to slice the mortadella as thinly as possible. It’s okay if it tears, as you’re going to rip it into pieces and pile it in heaps when you top the focaccia at the end.

  1. In a small bowl, combine 100 grams of the water with the yeast. Stir to dissolve and let sit until foamy, about 5 minutes.
  2. In a large bowl, combine the flour, remaining water, and 30 grams of olive oil. Add the yeast mixture, and mix thoroughly with your hands until all the visible flour is incorporated and a shaggy dough forms, about 3 minutes.
  3. Cover the dough loosely in plastic wrap and set aside to autolyse for 30 minutes. This will help the flour to become fully hydrated, activating enzymes that will help the yeast to access its nutrients.
  4. Sprinkle the salt over the dough and mix with your hands until fully incorporated. The dough should feel smooth and supple and a little taught.
  5. Cover with plastic wrap and allow the dough to sit at room temperature for about 1-2 hours to ferment. It should appear bubbly and nearly doubled in size. It's okay if it hasn't fully doubled by this point; it will continue to ferment in the fridge.
  6. Chill the covered dough for at least 8 hours, and up to 24. This lengthy fermentation will develop flavor and structure.
  7. Remove the dough from the fridge and allow the dough to warm slightly at room temperature, about 30 minutes.
  8. Apply 15g of olive oil to a 13x18" rimmed baking sheet and use a spatula to scrape the dough from the bowl onto the oiled sheet. Using oiled hands, gently stretch dough, pushing it into the corners of the pan. If it tenses up, let it rest for 5-10 minutes. This will allow the gluten to relax, making it easier to stretch.
  9. Using hands or a pastry brush, gently rub 15g of olive oil over the top of the dough. Cover gently in plastic wrap and allow to proof in a warm place for 1-2 hours, or until it's puffy and bubbly, and has grown to fill the tray. 30 minutes before baking, preheat the oven to 450°F.
  10. When the oven is preheated and the dough is puffy, use your fingers to press deep dimples across the entirety of the dough. Bubbles should rise to the surface, and the dough should spring back only slightly, leaving the dimples intact.
  11. Bake 10 minutes, until the focaccia is puffy, then working quickly, remove focaccia from the oven and arrange the provolone slices evenly across the top. Bake until crisp and golden brown, and the cheese is bubbly, 10-15 minutes more.
  12. Remove from oven, allow to cool slightly, then spoon half of the hot spread across the surface of the focaccia. Tear the mortadella slices into 3-to-4-inch pieces and arrange them on top, and then spoon over the remaining hot spread. Serve immediately.

Alex Testere

Alex Testere is a writer, editor, and illustrator based in Brooklyn. He spends most of his time cooking and thinking about his houseplants.

[email_signup id="3"]
<div class="email-subscribe exp-subscribe subscribe"> <div class="alert alert-success exp-success ga-etembed-success" style="display:none;"> Great! You've signed up successfully! </div> <div class="alert alert-danger exp-error" style="display:none;"> We are experiencing an error, please try again. </div> <form name="subscribe" id="email-signup" class="email-signup-form" action="https://www.tastecooking.com/wp-admin/admin-ajax.php" method="POST" target="_top" data-event-assigned="false"> <fieldset class="form-group form-inline email-submit-group"> <label for="email-address" class="sr-only">Email Address</label> <input id="email-newsletter" type="email" placeholder="your@email.com" class="email-newsletter text email form-control" name="email" value=""> <button type="submit" value="Subscribe" name="subscribe" class="btn btn-primary email-submit-btn ga-etembed-success"> <i class="fa fa-envelope"></i> Subscribe </button> </fieldset> <small class="exp-small terms" style=""> By clicking Subscribe, I acknowledge that I have read and agree to the Penguin Random House <a href="http://www.penguinrandomhouse.com/privacy/" target="_blank">Privacy Policy</a> and <a href="http://www.penguinrandomhouse.com/terms/" target="_blank">Terms of Use</a> and agree to receive news and updates from TASTE and Penguin Random House. </small> <fieldset class="field-group checkboxes" style="display:none"> <div class="checkbox"> <label> <input type="checkbox" name="programs[]" value="505,50501,1" class="exp-checkbox" checked="checked"> <span><strong>Tastebook General</strong></span> </label> </div> <div class="checkbox"> <label> <input type="checkbox" name="programs[]" value="505,50502,1" class="exp-checkbox" checked="checked"> <span><strong>Tastebook Promo</strong></span> </label> </div> </fieldset><!-- /.checkboxes --> <input type="hidden" name="data_acq_code" value="TASTE_POPUP_STATIC_ONGOING" /> <input type="hidden" name="data_programs" value="50501|505,50502|505" /> <input type="hidden" name="form_id" value="3" /> <input type="hidden" name="partner" value="" /> <input type="hidden" name="action" value="crown_email_signup_submit" /> <input type="hidden" name="ref_url" value="" /> </form> </div> <script> jQuery(document).ready(function () { var unassigned_forms; setInterval( function() { //Check for unassigned forms var forms = jQuery( '.email-signup-form' ); unassigned_forms = false; forms.each( function( index ) { if ( jQuery( this ).attr( 'data-event-assigned' ) === 'false' ) { unassigned_forms = true; } }); if ( unassigned_forms ) { forms.off( 'submit' ).on( 'submit', function ( e ) { forms.attr( 'data-event-assigned', 'true' ); e.preventDefault(); // Basic email validation var email = jQuery(e.target).find('.email-newsletter').val(), valid_email = false, groupEl = jQuery(e.target).closest('.email-subscribe'); if ( !!email && typeof(email) === "string" ) { var email_array = email.split('@'); if ( email_array.length === 2 ) { if ( email_array[1].split('.').length > 1 ) { valid_email = true; } } } if ( valid_email ) { jQuery('.alert-danger').hide(); // Show loading gif groupEl.find('.email-signup-form').hide(); groupEl.find('.email-submit-loading').show(); // Populate ref_url jQuery(this).find('input[name="ref_url"]').val(window.location.href); // Generate Payload var payload = jQuery(this).serializeArray(); jQuery.ajax({ url: jQuery(this).attr('action'), type: 'POST', data: payload, success: function (data) { // Hide loading spinner groupEl.find('.email-signup-form').show(); groupEl.find('.email-submit-loading').hide(); // Display success msg var target = jQuery(e.target); jQuery(e.target).hide(); jQuery(e.target).parent().find('.alert-success').show(); jQuery(e.target).parent().find('#downloadbtn').show(); }, fail: function (err) { // Hide loading spinner groupEl.find('.email-signup-form').show(); groupEl.find('.email-submit-loading').hide(); // Display failure msg var target = jQuery(e.target); jQuery(e.target).hide(); jQuery(e.target).parent().find('.alert-danger').show(); } }); } else { groupEl.find('.alert-danger').html('Please enter a valid email address.').show(); } }); forms.off( 'keypress' ).on( 'keypress', function ( e ) { if ( e.which === 13 ) { e.preventDefault(); jQuery( this ).submit(); } }); } }, 100); }); </script>
[email_signup id="3"]
<div class="email-subscribe exp-subscribe subscribe"> <div class="alert alert-success exp-success ga-etembed-success" style="display:none;"> Great! You've signed up successfully! </div> <div class="alert alert-danger exp-error" style="display:none;"> We are experiencing an error, please try again. </div> <form name="subscribe" id="email-signup" class="email-signup-form" action="https://www.tastecooking.com/wp-admin/admin-ajax.php" method="POST" target="_top" data-event-assigned="false"> <fieldset class="form-group form-inline email-submit-group"> <label for="email-address" class="sr-only">Email Address</label> <input id="email-newsletter" type="email" placeholder="your@email.com" class="email-newsletter text email form-control" name="email" value=""> <button type="submit" value="Subscribe" name="subscribe" class="btn btn-primary email-submit-btn ga-etembed-success"> <i class="fa fa-envelope"></i> Subscribe </button> </fieldset> <small class="exp-small terms" style=""> By clicking Subscribe, I acknowledge that I have read and agree to the Penguin Random House <a href="http://www.penguinrandomhouse.com/privacy/" target="_blank">Privacy Policy</a> and <a href="http://www.penguinrandomhouse.com/terms/" target="_blank">Terms of Use</a> and agree to receive news and updates from TASTE and Penguin Random House. </small> <fieldset class="field-group checkboxes" style="display:none"> <div class="checkbox"> <label> <input type="checkbox" name="programs[]" value="505,50501,1" class="exp-checkbox" checked="checked"> <span><strong>Tastebook General</strong></span> </label> </div> <div class="checkbox"> <label> <input type="checkbox" name="programs[]" value="505,50502,1" class="exp-checkbox" checked="checked"> <span><strong>Tastebook Promo</strong></span> </label> </div> </fieldset><!-- /.checkboxes --> <input type="hidden" name="data_acq_code" value="TASTE_POPUP_STATIC_ONGOING" /> <input type="hidden" name="data_programs" value="50501|505,50502|505" /> <input type="hidden" name="form_id" value="3" /> <input type="hidden" name="partner" value="" /> <input type="hidden" name="action" value="crown_email_signup_submit" /> <input type="hidden" name="ref_url" value="" /> </form> </div> <script> jQuery(document).ready(function () { var unassigned_forms; setInterval( function() { //Check for unassigned forms var forms = jQuery( '.email-signup-form' ); unassigned_forms = false; forms.each( function( index ) { if ( jQuery( this ).attr( 'data-event-assigned' ) === 'false' ) { unassigned_forms = true; } }); if ( unassigned_forms ) { forms.off( 'submit' ).on( 'submit', function ( e ) { forms.attr( 'data-event-assigned', 'true' ); e.preventDefault(); // Basic email validation var email = jQuery(e.target).find('.email-newsletter').val(), valid_email = false, groupEl = jQuery(e.target).closest('.email-subscribe'); if ( !!email && typeof(email) === "string" ) { var email_array = email.split('@'); if ( email_array.length === 2 ) { if ( email_array[1].split('.').length > 1 ) { valid_email = true; } } } if ( valid_email ) { jQuery('.alert-danger').hide(); // Show loading gif groupEl.find('.email-signup-form').hide(); groupEl.find('.email-submit-loading').show(); // Populate ref_url jQuery(this).find('input[name="ref_url"]').val(window.location.href); // Generate Payload var payload = jQuery(this).serializeArray(); jQuery.ajax({ url: jQuery(this).attr('action'), type: 'POST', data: payload, success: function (data) { // Hide loading spinner groupEl.find('.email-signup-form').show(); groupEl.find('.email-submit-loading').hide(); // Display success msg var target = jQuery(e.target); jQuery(e.target).hide(); jQuery(e.target).parent().find('.alert-success').show(); jQuery(e.target).parent().find('#downloadbtn').show(); }, fail: function (err) { // Hide loading spinner groupEl.find('.email-signup-form').show(); groupEl.find('.email-submit-loading').hide(); // Display failure msg var target = jQuery(e.target); jQuery(e.target).hide(); jQuery(e.target).parent().find('.alert-danger').show(); } }); } else { groupEl.find('.alert-danger').html('Please enter a valid email address.').show(); } }); forms.off( 'keypress' ).on( 'keypress', function ( e ) { if ( e.which === 13 ) { e.preventDefault(); jQuery( this ).submit(); } }); } }, 100); }); </script>