Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

The code below is not working, it should find duplicate values using jQuery:

$().SPServices({
    operation: "GetListItems",
    listName: "Questions",
    async: false,
    CAMLQery: query,
    completefunc: function(xData,status)
        {
            $(xDataresponseXML).find("\\z:row").each(function()
                {
                    var duid-$(this).attr("ID");
                        if(i==duid)
                            {
                                alert("Found");
                            }

                 });   
         }

});  
share|improve this question
add comment

2 Answers 2

A small example to get the items, show them, find duplicates and show the unique ones:

<script type="text/javascript">

  $(document).ready(function () {

  var items = {};

  $().SPServices({
  operation: "GetListItems",
  async: false,
  listName: "Cities",
  CAMLViewFields: "<ViewFields><FieldRef Name='Title' /></ViewFields>",
  completefunc: function (xData, Status) {
  $(xData.responseXML).find("[nodeName='z:row']").each(function () {
  var title = $(this).attr("ows_Title");
  $("#results").append(title);

  if(items[title])
  $this.remove();
  else
  items[title]=true;

  });
  }
  });


  $.each(items,
  function (value) {
  $("#noduplicates").append(value);
  });


  });

</script>
<div id="results">
</div>

<br />
<br />
<br />

<div id="noduplicates"></div>

I used a simple custom list named 'Cities' and added no extra columns, just used the Title field. When entering a duplicates value into the Title column, this item will show in the div 'results', but not in the div 'noduplicates'. I think this example will help you build your solution.

share|improve this answer
    
Hi Anita,Thanks for your response.But i am not able to get the list items and below is the code will you view and respond to me.And the end i used alert message to get the list item value which i am not able to get var i=$(this).attr('A'); alert(i);.I am able to connect to list but not able to get the list item value .Would please tell me is the above code write to get list item value or not. –  mdsiddiqali Oct 22 '11 at 7:13
    
Ow, you're not getting the items at all? That's a different question. I'll update my answer with some more info which may help you. –  Anita Boerboom Oct 24 '11 at 7:05
add comment

What are you trying to accomplish?

Just by looking I have the following remarks:

  • There is a - after var duid, shouldn't that be an =?
  • What value has i? Where is it set?
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.