jQuery json crossdomain example

<script src=”http://code.jquery.com/jquery-1.5.js”></script>

<script>

$(“#enews_signup_form”).submit(function(event) {

// stop form from submitting normally
event.preventDefault();

$( “#result” ).html (“submitting…”);

var $form = $( this ),
term = $form.find( ‘input[name=”enews_email”]’ ).val(),
url = $form.attr( ‘action’ );

$.getJSON(url + “?email=” + term + “&jsoncallback=?”, function(data){
$( “#result” ).html( data[‘error’] );
});

});

</script>

<? php

echo $_REQUEST[‘jsoncallback’] . ‘(‘ . json_encode($this-> viewresult) . ‘)’;

?>

Leave a Reply

You must be logged in to post a comment.