Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.