Jump to content

invalid label [ jQuery ]


webtuto

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/162878-invalid-label-jquery/
Share on other sites

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 ;)

Link to comment
https://forums.phpfreaks.com/topic/162878-invalid-label-jquery/#findComment-859758
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.