Thanks Chan it is working!
12 Aralık 2015 Cumartesi 04:34:04 UTC+2 tarihinde mihawk yazdı:
>
> hi,
> from doc:
> {output, Output::iolist(), Headers::proplist()}
>
> Skip views altogether and return Output to the client while setting
> additional HTTP Headers.
> in your case, should be:
>
> index('GET', []) ->
> {ok,Data} = file:read_file("./ln.json"),
> {output,Data, [{"Content-Type","application/j-son;charset=UTF-8"}]}.
>
> chan.
>
>
> 2015-12-12 5:07 GMT+08:00 Mert Öztürk <[email protected] <javascript:>>
> :
>
>> Hello,
>>
>> I am struggling to get my json file through controller and get action. I
>> tried with this below;
>>
>> index('GET', []) ->
>> {ok,Data} = file:read_file("./ln.json"),
>> {json,Data}.
>>
>> and also with;
>>
>> index('GET', []) ->
>> {ok,Data} = file:read_file("./ln.json"),
>> {json,binary_to_list(Data)}.
>>
>> Clientside:
>>
>> $.ajax({
>> type: "GET",
>> async: false,
>> beforeSend: function(x) {
>> if(x && x.overrideMimeType) {
>> x.overrideMimeType("application/j-son;charset=UTF-8");
>> }
>> },
>> dataType: "json",
>> success: function(data){
>> JSON = data
>> }
>> });
>>
>> I can read json file but couldnt send json data to client. Help will be
>> appreciated.
>>
>> Thanks
>> Mert
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "ChicagoBoss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> Visit this group at http://groups.google.com/group/chicagoboss.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/chicagoboss/f20d5420-8732-4773-ad16-fd8a73577df6%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/chicagoboss/f20d5420-8732-4773-ad16-fd8a73577df6%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
You received this message because you are subscribed to the Google Groups
"ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at https://groups.google.com/group/chicagoboss.
To view this discussion on the web visit
https://groups.google.com/d/msgid/chicagoboss/f8677dd2-a57f-4426-b230-b31d9f15c7c5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.