Jump to content

JSON


joycecwj

Recommended Posts

to run json function is it need a json function call?

i read alot example all the json function start with $(document).ready(function(){

if i dun wan to do that my json function will run?

 

Huh?

Link to comment
Share on other sites

sorry sorry.

is like how to run a json function.

its need any function call?

example :

function save(){
 var finalpoint=marker.getPoint();
 //alert (finalpoint);

// alert(finalpoint);
// var JSONObject = new Object;
var data = finalpoint;
data[data.length]={name:"data",value:data[0]};
//alert(data);
 /*var data = $("#add-point :input").serializeArray();

				data[data.length] = { name: "lng", value: finalpoint[0] };
				data[data.length] = { name: "lat", value: finalpoint[1] };
				alert(data.value);alert(data.value);*/
				// var dataString = $.toJSON(finalpoint); 
				/*$.ajax({
                                  type: "POST",
                                  url: URL,
                                  cache:false,
                                  data: values,
                                  dataType:'json',
                                  success: function(json)
                   {*/
			$("#add-point").submit(function(){


				 $.post($("#add-point").attr('action'),data, function(json){
				 alert (data);
					//$("#add-point .error").fadeOut();
					if (json.status == "fail") {
						$("#add-point .error").html(json.message).fadeIn();
					}
					if (json.status == "success") {
						$("#add-point :input[name!=action]").val("");
						var location = json.data;
						alert(location);
					}
				}, "json");
				return false;

				});
			}

oni need to write save(); to execute it?

understand wat i mean?

Link to comment
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.