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

I am using a SPServices (jQuery Library for SharePoint webservice) to grab list items. I have managed to get the data as follows:

<z:row ows_Date_x0020_From="2013-06-03 00:00:00"
 ows_Date_x0020_To="2013-06-05 00:00:00" ows_Approver="9;#MV\tengsung"
 ows_Leave_x0020_Type="1;#AL" ows__ModerationStatus="0" ows__Level="1"
 ows_ID="1" ows_UniqueId="1;#{7A76C1C6-183A-44DE-AE20-DE341A7CADCA}"
 ows_owshiddenversion="4" ows_FSObjType="1;#0" ows_Created="2013-06-03
 17:08:38" ows_Date_x0020_Applied="2013-06-03 18:00:00"
 ows_PermMask="0x7fffffffffffffff" ows_Modified="2013-06-03 17:46:21"
 ows_Employee_x0020_Name="10;#sokyee"
 ows_FileRef="1;#Lists/Leaves/1_.000" ows_MetaInfo="1;#"/>

How can I omit the Special SP Characters, e.g. "10;#Albert" or "1;#AL", and take only the value?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

This is how I do it typically:

var leave = $(this).attr("ows_Leave_x0020_Type").split(";#")[1];

Meaning for this z:row, get the leave type attribute, split the string on ;# and give me the second item in the array it creates as arrays are zero indexed to give you AL or [0] to get you the index/ID value of the item.

share|improve this answer
    
I am new to this, may I know what is the value before ";#"? –  Edward Low Jun 5 '13 at 3:48
    
updated answer, it's basically an internal ID –  PirateEric Jun 5 '13 at 4:32
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.