How to create a texture from a image getting by ajax

Getting the data that contains obj, mtl and jpg from the server by ajax, the data of obj and mtl can handle in the right way, but no texture.
And i want to create a vtkTexture Object to stick on the vtkActor from the jpg data returning from ajax, I have tried many times, it is failure until now, anybody know this.