webtuto Posted June 19, 2009 Share Posted June 19, 2009 hi , i used jQuery to put data on the database i always do the same code and it work but this time no anyway here is the code i used -> jQuery(function($) { $('#send').click(function() { var msg = $('#msg').val(); var time = $('#time').val(); url: 'to_db.php', type: 'POST', data: 'msg=' + msg + '&time=' + time, success: function(result) { $('#response').remove(); $('#messages').append('<p id="response">' + result + '</p>'); }; return false; }); }); but FIREBUG give me this error invalid label type: 'POST',\n hope you can provide me with the solutions , thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/162878-invalid-label-jquery/ Share on other sites More sharing options...
RichardRotterdam Posted June 19, 2009 Share Posted June 19, 2009 look at the following url: 'to_db.php', That's how you usually set an attribute of an object in javascript however, you didn't start an object. now take a look at the following ajax code taken from the jQuery site $.ajax({ type: "GET", url: "test.js", dataType: "script" }); notice how it has $.ajax({ before type:"GET" that should prob solve your problem Quote Link to comment https://forums.phpfreaks.com/topic/162878-invalid-label-jquery/#findComment-859758 Share on other sites More sharing options...
Ken2k7 Posted June 20, 2009 Share Posted June 20, 2009 Alternatively, $.get would be the same. Quote Link to comment https://forums.phpfreaks.com/topic/162878-invalid-label-jquery/#findComment-860039 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.