Jump to content

  •  

Photo

Need guidence with Ajax


  • Please log in to reply
1 reply to this topic

#1 macbook  newbie

macbook
  • Members
  • 13 posts
  • FM Application:11
  • Time Online: 12h 1m 19s

Posted 17 May 2011 - 09:07 AM

Hi Guys ,

I am New to Web developing and Working on File maker web site. I need to create and retrieve the data at same time (with conditions). I think the best idea will be integrate Ajax with PHP. But didn't found any good resource to learn how to integrate this. Can some one provide sample file ? or is there any recommended books or Video Tutorials ?

Thanks and waiting for some one's reply

AL
  • 0

#2 lance123  FM Developer

lance123
  • Members
  • 68 posts
  • FM Application:11 Advance
  • Time Online: 4d 13h 10m 47s

Posted 17 May 2011 - 02:54 PM

Hi Al,

Ajax is a great way to go, but does take a little to get your head around. Once you get it, you don't want to go back. I can recommend Jquery to make things easier. (cross browser compatible with fallbacks). I have used many other ways but this is the most common and does seem to get attention and updates regularly as a framework. Also, you can use it for many other things that you will no doubt want in the future such as manipulation of the dom. (document object model.)

here is a code snippet that covers the jquery part. also you need the php that will modify the record using your parameters fed across to it in post or get.
//start snippet
jQuery.ajax({
beforeSend:function() {
document.getElementById('divID<?php echo $FormNumber2;?>').innerHTML="<IMG SRC ='jqgrid37/spinner/spinner-large.gif'>";
},
type: "POST",
url: "edit.php",
data: myPostData,
success: function(msg){
document.getElementById('divID<?php echo $FormNumber2;?>').innerHTML="";
}
});
//end snippet

of course you need your page setup with the following link and the files in place to support jquery

<script src="js/jquery-1.5.1.min.js" type="text/javascript"></script>

You are best to read the jquery documents on this. myPostData is a javascript variable populated with what you will hand over to your php and is picked up in:
$UniqueOrderCode=$_POST["UniqueOrderCode"];

You then just use this post param or others you send in your php edit.php

var myPostData='UniqueOrderCode='+document.formMyForm['FormNumber2'].value;

Hope this helps some.

Regards,

Lance
  • 0




FMForum Advertisers