How can i achieve no postback when inserting an item to another list

Jan 12, 2012 at 7:05 AM

Hi All,
   I have a list and i have a link on this list to insert a new record to another list.
Its working fine.
But another thing i need is when i click on the link/button i want the status to change based on the data from the other list.
So when you click this link i would insert a record to the other list and then compare the data from these 2 lists and the show some status.But i don't want the list i'm clicking on to refresh but just update async.

 

** What i want it for is to track users who have read an item.Its like an email using a list.
If item is read they get an opened envelope if not closed.
So any time they hit the page i check if they are in the other list and if yes its means they have read the item.

Thanks in advance

Coordinator
Jan 12, 2012 at 1:10 PM

If you use SPServices to do the reads and writes, then there shouldn't be any postbacks; you'll be doing everything with AJAX.

M.

Jan 13, 2012 at 6:39 AM

Thanks Marc.

I have one question for you .

Can i have a nested SP Services trying  to compare rows in 2 differenct list like so

 

<script type="text/javascript">

$().SPServices({
		operation: "GetListItems",
		listName: 'ReadList',
		async: false,
		completefunc: function (xData, Status) {
			$(xData.responseXML).find("[nodeName='z:row']").each(function() { 

				var id1 = $(this).attr("ows_ID"); 
                alert(id1);
				
				 });
				} 
			}); 

$().SPServices({
		operation: "GetListItems",
		listName: 'Comms',
		async: false,
		completefunc: function (xData, Status) {
			$(xData.responseXML).find("[nodeName='z:row']").each(function() { 

				var id2 = $(this).attr("ows_ID"); 
                alert(id2);
				
				 });
				} 
			}); 


</script>

Want to compare id1 with id2.

Cheers

Coordinator
Jan 13, 2012 at 1:55 PM

Yes, and you can also next one call to the Web Services within another, something like this (which I'm only cxreating by copying and pasting, so it's not "the answer"):

$().SPServices({
  operation: "GetListItems",
  listName: 'ReadList',
  async: false,
  completefunc: function (xData, Status) {
    $(xData.responseXML).find("[nodeName='z:row']").each(function() { 
      var id1 = $(this).attr("ows_ID"); 
      alert(id1);
      $().SPServices({
         operation: "GetListItems",
         listName: 'Comms',
         CAMLQuery: // some CAML here to filter for the item(s) above,
         async: false,
         completefunc: function (xData, Status) {
           $(xData.responseXML).find("[nodeName='z:row']").each(function() { 
             var id2 = $(this).attr("ows_ID"); 
             alert(id2);
           });
         } 
      });
    });
  } 
}); 

M.