Home > Web Front-end > JS Tutorial > The specific implementation method of using jquery to access photos_jquery

The specific implementation method of using jquery to access photos_jquery

WBOY
Release: 2016-05-16 17:30:48
Original
1214 people have browsed it

1. Use jquery to call the function in aspx:

Copy the code The code is as follows:

sajax("***.aspx/DoSave", //A URL address, pointing to the ASPX where the function is located
 null,//Parameters, the parameters required by the pointed ASPX function
showSaveResult);/ /jS script executed after successful execution

2. Function sajax
Copy code The code is as follows:

function sajax(url, data, successcallback)
{
$.ajax({ : data,  
 async: false,  
 contentType: "application/json;charset=utf-8",  
 dataType: "json",  
 success: successcallback,  
ode: {                 
404: function () { alert('page not found'); },
500: function () { alert('Internal server error');                                                                                           > };



3. Background function:
cs code



Copy code

The code is as follows: [WebMethod(EnableSession = true)] //AJAX call must be a function declared in this way EnableSession--》Use Session to access photospublic static void DoSave (){ byte[] byZhaoPian; byZhaoPian = (byte[])(HttpContext.Current. Session["image"]);                                                   🎜>catch                                                                                  >
4. How to assign value to Session["image"]



After selecting the photo, when you click OK to upload, convert the image into binary and assign it to Session["image"]

5. The method of uploading photos will not be written here, please check other articles
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template