0

This is my first question on Stackoverflow, thanks in advance for all people for making our life easier. Sorry for my English, it's not very good.

I have this code in my server:

<html>
  <head>
    <title></title>
    <meta content="">
    <style></style>
  </head>
  <body>

<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>


<script>
$(document).ready(function(){
$("#newsletter").submit(function(){
$.ajax(
{
type: "POST",
url:"http://mailing.estudiohernangene.com/lists/?p=subscribe&id=2",
data: $('#newsletter').serialize(),
success:function(result)
{
$("#mensaje_ok").html("¡Hecho!");
}
});
$("#mensaje_ok").html("¡Hecho!");
$("#email").val("");
$("#enviar").fadeToggle();
return false;
});
});
</script>

<div id="inserccion" style="float:left; border:0px solid; vertical align:middle; padding: -10px 0 0 0;">
<form id="newsletter" method="" action="">
      <input type="hidden" name="VerificationCodeX" value="" />
      <input type="hidden" name="list[2]" value="signup">
      <input type="hidden" name="listname[3]" value="todos"/>
      <input type="hidden" name="subscribe" value='subscribe'/>
      <span style="padding:0 5px 0 0; vertical-align: middle;">Newsletter:</span>
      <input type="text" style="" value="" size="20" name="email" id="email" placeholder="Suscr&#237;bete con tu email">
      <input class="button" type="submit" id="enviar" value="OK" name="submit">
</form>
</div>
<span id="mensaje_ok" style="float:left; padding: 2px 0 0 0;"></span>

</body>
</html>

If I change the jquery library of Wordpress for the original library, the Wordpress does not work well.

<script src="http://www.estudiohernangene.com/wp-includes/js/jquery/jquery.js?ver=1.10.2"></script>

The examples is in this url:

http://www.estudiohernangene.com/prueba_ok.php

http://www.estudiohernangene.com/prueba_ko.php

What's happend?

Thanks!

Juanmi.

Juanmi
  • 3
  • 1
  • If you did some basic error checking, you'd see the problem. [jQuery Uncaught TypeError: Property '$' of object \[object Window\] is not a function](http://stackoverflow.com/questions/10807200/jquery-uncaught-typeerror-property-of-object-object-window-is-not-a-funct) – Ben Fortune Nov 04 '13 at 13:05

1 Answers1

0

Use

 jQuery(...

instead of

$(...

.

<script>
jQuery(function($) {
jQuery(document).ready(function(){
jQuery("#newsletter").submit(function(){
jQuery.ajax(
  {
  type: "POST",
  url:"http://mailing.estudiohernangene.com/lists/?p=subscribe&id=2",
  data: jQuery('#newsletter').serialize(),
  success:function(result)
 {
 jQuery("#mensaje_ok").html("¡Hecho!");
}
});
 jQuery("#mensaje_ok").html("¡Hecho!");
 jQuery("#email").val("");
 jQuery("#enviar").fadeToggle();
 return false;
 });

 });
</script>

This should work

Bellash
  • 7,560
  • 6
  • 53
  • 86